From 5691a25b7ad59d786b8deba1a4d5cd6ff231a6cc Mon Sep 17 00:00:00 2001 From: George Sittas Date: Fri, 30 Jan 2026 14:56:06 +0200 Subject: [PATCH 1/2] Chore!: bump sqlglot to v28.7.0 --- pyproject.toml | 2 +- sqlmesh/core/state_sync/common.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bf86114956..bda22257ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ "requests", "rich[jupyter]", "ruamel.yaml", - "sqlglot[rs]~=28.6.0", + "sqlglot[rs]~=28.7.0", "tenacity", "time-machine", "json-stream" diff --git a/sqlmesh/core/state_sync/common.py b/sqlmesh/core/state_sync/common.py index 056565b060..2e8c67ac29 100644 --- a/sqlmesh/core/state_sync/common.py +++ b/sqlmesh/core/state_sync/common.py @@ -140,7 +140,7 @@ def all_batch_range(cls) -> ExpiredBatchRange: def _expanded_tuple_comparison( cls, columns: t.List[exp.Column], - values: t.List[exp.Literal], + values: t.List[t.Union[exp.Literal, exp.Neg]], operator: t.Type[exp.Expression], ) -> exp.Expression: """Generate expanded tuple comparison that works across all SQL engines. From ac1ff204d8a5e4c7b3fe6af6b48c7c60cf8f3463 Mon Sep 17 00:00:00 2001 From: George Sittas Date: Fri, 30 Jan 2026 15:47:33 +0200 Subject: [PATCH 2/2] Fix tests --- tests/core/test_snapshot_evaluator.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/core/test_snapshot_evaluator.py b/tests/core/test_snapshot_evaluator.py index 9dd645ac15..1413ac81f1 100644 --- a/tests/core/test_snapshot_evaluator.py +++ b/tests/core/test_snapshot_evaluator.py @@ -2131,7 +2131,7 @@ def test_temp_table_includes_schema_for_ignore_changes( model = SqlModel( name="test_schema.test_model", kind=IncrementalByTimeRangeKind( - time_column="a", on_destructive_change=OnDestructiveChange.IGNORE + time_column="ds", on_destructive_change=OnDestructiveChange.IGNORE ), query=parse_one("SELECT c, a FROM tbl WHERE ds BETWEEN @start_ds and @end_ds"), ) @@ -2148,6 +2148,7 @@ def columns(table_name): return { "c": exp.DataType.build("int"), "a": exp.DataType.build("int"), + "ds": exp.DataType.build("timestamp"), } adapter.columns = columns # type: ignore @@ -4321,13 +4322,14 @@ def test_multiple_engine_promotion(mocker: MockerFixture, adapter_mock, make_sna def columns(table_name): return { "a": exp.DataType.build("int"), + "ds": exp.DataType.build("timestamp"), } adapter.columns = columns # type: ignore model = SqlModel( name="test_schema.test_model", - kind=IncrementalByTimeRangeKind(time_column="a"), + kind=IncrementalByTimeRangeKind(time_column="ds"), gateway="secondary", query=parse_one("SELECT a FROM tbl WHERE ds BETWEEN @start_ds and @end_ds"), ) @@ -4350,10 +4352,10 @@ def columns(table_name): cursor_mock.execute.assert_has_calls( [ call( - 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' + 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)' ), call( - 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' + 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)' ), ] )