Skip to content

Commit de2476b

Browse files
authored
Chore!: bump sqlglot to v26.3.8 (#3716)
1 parent 377d2d5 commit de2476b

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"rich[jupyter]",
4848
"ruamel.yaml",
4949
"setuptools; python_version>='3.12'",
50-
"sqlglot[rs]~=26.2.1",
50+
"sqlglot[rs]~=26.3.8",
5151
"tenacity",
5252
"time-machine",
5353
],

tests/core/engine_adapter/test_athena.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,37 @@ def test_ctas_iceberg_no_specific_location(adapter: AthenaEngineAdapter):
238238
assert to_sql_calls(adapter) == []
239239

240240

241+
def test_ctas_iceberg_partitioned(adapter: AthenaEngineAdapter):
242+
expressions = d.parse(
243+
"""
244+
MODEL (
245+
name test_table,
246+
kind INCREMENTAL_BY_TIME_RANGE (
247+
time_column business_date
248+
),
249+
table_format iceberg,
250+
start '2025-01-15'
251+
);
252+
253+
SELECT 1::timestamp AS business_date, 2::varchar as colb, 'foo' as colc;
254+
"""
255+
)
256+
model: SqlModel = t.cast(SqlModel, load_sql_based_model(expressions))
257+
258+
adapter.s3_warehouse_location = "s3://bucket/prefix/"
259+
adapter.ctas(
260+
table_name=model.name,
261+
columns_to_types=model.columns_to_types,
262+
partitioned_by=model.partitioned_by,
263+
query_or_df=model.ctas_query(),
264+
table_format=model.table_format,
265+
)
266+
267+
assert to_sql_calls(adapter) == [
268+
"""CREATE TABLE IF NOT EXISTS "test_table" WITH (table_type='iceberg', partitioning=ARRAY['business_date'], location='s3://bucket/prefix/test_table/', is_external=false) AS SELECT CAST("business_date" AS TIMESTAMP) AS "business_date", CAST("colb" AS VARCHAR) AS "colb", CAST("colc" AS VARCHAR) AS "colc" FROM (SELECT CAST(1 AS TIMESTAMP) AS "business_date", CAST(2 AS VARCHAR) AS "colb", 'foo' AS "colc" LIMIT 0) AS "_subquery\""""
269+
]
270+
271+
241272
def test_replace_query(adapter: AthenaEngineAdapter, mocker: MockerFixture):
242273
mocker.patch(
243274
"sqlmesh.core.engine_adapter.athena.AthenaEngineAdapter.table_exists", return_value=True

0 commit comments

Comments
 (0)