Skip to content

Commit ac1ff20

Browse files
committed
Fix tests
1 parent 5691a25 commit ac1ff20

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/core/test_snapshot_evaluator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ def test_temp_table_includes_schema_for_ignore_changes(
21312131
model = SqlModel(
21322132
name="test_schema.test_model",
21332133
kind=IncrementalByTimeRangeKind(
2134-
time_column="a", on_destructive_change=OnDestructiveChange.IGNORE
2134+
time_column="ds", on_destructive_change=OnDestructiveChange.IGNORE
21352135
),
21362136
query=parse_one("SELECT c, a FROM tbl WHERE ds BETWEEN @start_ds and @end_ds"),
21372137
)
@@ -2148,6 +2148,7 @@ def columns(table_name):
21482148
return {
21492149
"c": exp.DataType.build("int"),
21502150
"a": exp.DataType.build("int"),
2151+
"ds": exp.DataType.build("timestamp"),
21512152
}
21522153

21532154
adapter.columns = columns # type: ignore
@@ -4321,13 +4322,14 @@ def test_multiple_engine_promotion(mocker: MockerFixture, adapter_mock, make_sna
43214322
def columns(table_name):
43224323
return {
43234324
"a": exp.DataType.build("int"),
4325+
"ds": exp.DataType.build("timestamp"),
43244326
}
43254327

43264328
adapter.columns = columns # type: ignore
43274329

43284330
model = SqlModel(
43294331
name="test_schema.test_model",
4330-
kind=IncrementalByTimeRangeKind(time_column="a"),
4332+
kind=IncrementalByTimeRangeKind(time_column="ds"),
43314333
gateway="secondary",
43324334
query=parse_one("SELECT a FROM tbl WHERE ds BETWEEN @start_ds and @end_ds"),
43334335
)
@@ -4350,10 +4352,10 @@ def columns(table_name):
43504352
cursor_mock.execute.assert_has_calls(
43514353
[
43524354
call(
4353-
f'DELETE FROM "sqlmesh__test_schema"."test_schema__test_model__{snapshot.version}" WHERE "a" BETWEEN 2020-01-01 00:00:00+00:00 AND 2020-01-02 23:59:59.999999+00:00'
4355+
f'DELETE FROM "sqlmesh__test_schema"."test_schema__test_model__{snapshot.version}" WHERE "ds" BETWEEN CAST(\'2020-01-01 00:00:00\' AS TIMESTAMP) AND CAST(\'2020-01-02 23:59:59.999999\' AS TIMESTAMP)'
43544356
),
43554357
call(
4356-
f'INSERT INTO "sqlmesh__test_schema"."test_schema__test_model__{snapshot.version}" ("a") SELECT "a" FROM (SELECT "a" AS "a" FROM "tbl" AS "tbl" WHERE "ds" BETWEEN \'2020-01-01\' AND \'2020-01-02\') AS "_subquery" WHERE "a" BETWEEN 2020-01-01 00:00:00+00:00 AND 2020-01-02 23:59:59.999999+00:00'
4358+
f'INSERT INTO "sqlmesh__test_schema"."test_schema__test_model__{snapshot.version}" ("a", "ds") SELECT "a", "ds" FROM (SELECT "a" AS "a" FROM "tbl" AS "tbl" WHERE "ds" BETWEEN \'2020-01-01\' AND \'2020-01-02\') AS "_subquery" WHERE "ds" BETWEEN CAST(\'2020-01-01 00:00:00\' AS TIMESTAMP) AND CAST(\'2020-01-02 23:59:59.999999\' AS TIMESTAMP)'
43574359
),
43584360
]
43594361
)

0 commit comments

Comments
 (0)