Skip to content

Commit 5a521cb

Browse files
treyspfresioAS
authored andcommitted
Fix: create_test error with query and CTEs included (SQLMesh#5559)
Signed-off-by: fresioAS <andreas.fredhoi@three60energy.com>
1 parent a8aa382 commit 5a521cb

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎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)