Skip to content

Commit a0668dc

Browse files
authored
Fix: create_test error with query and CTEs included (#5559)
1 parent a98b5c4 commit a0668dc

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sqlmesh/core/test/definition.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,7 @@ def generate_test(
925925
cte_output = test._execute(cte_query)
926926
ctes[cte.alias] = (
927927
pandas_timestamp_to_pydatetime(
928-
cte_output.apply(lambda col: col.map(_normalize_df_value)),
929-
cte_query.named_selects,
928+
df=cte_output.apply(lambda col: col.map(_normalize_df_value)),
930929
)
931930
.replace({np.nan: None})
932931
.to_dict(orient="records")

sqlmesh/utils/date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def to_time_column(
444444

445445

446446
def pandas_timestamp_to_pydatetime(
447-
df: pd.DataFrame, columns_to_types: t.Optional[t.Dict[str, exp.DataType]]
447+
df: pd.DataFrame, columns_to_types: t.Optional[t.Dict[str, exp.DataType]] = None
448448
) -> pd.DataFrame:
449449
import pandas as pd
450450
from pandas.api.types import is_datetime64_any_dtype # type: ignore

0 commit comments

Comments
 (0)