Skip to content

Commit 5211a57

Browse files
authored
Chore!: bump sqlglot to v28.7.0 (#5686)
1 parent 9213f60 commit 5211a57

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies = [
2424
"requests",
2525
"rich[jupyter]",
2626
"ruamel.yaml",
27-
"sqlglot[rs]~=28.6.0",
27+
"sqlglot[rs]~=28.7.0",
2828
"tenacity",
2929
"time-machine",
3030
"json-stream"

sqlmesh/core/state_sync/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def all_batch_range(cls) -> ExpiredBatchRange:
140140
def _expanded_tuple_comparison(
141141
cls,
142142
columns: t.List[exp.Column],
143-
values: t.List[exp.Literal],
143+
values: t.List[t.Union[exp.Literal, exp.Neg]],
144144
operator: t.Type[exp.Expression],
145145
) -> exp.Expression:
146146
"""Generate expanded tuple comparison that works across all SQL engines.

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)