Skip to content

Commit 9213f60

Browse files
authored
Chore!: bump sqlglot to 28.6.0 (#5680)
1 parent 4f833af commit 9213f60

File tree

21 files changed

+80
-84
lines changed

21 files changed

+80
-84
lines changed

.circleci/test_migration.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ TEST_DIR="$TMP_DIR/$EXAMPLE_NAME"
2424

2525
echo "Running migration test for '$EXAMPLE_NAME' in '$TEST_DIR' for example project '$EXAMPLE_DIR' using options '$SQLMESH_OPTS'"
2626

27+
# Copy the example project from the *current* checkout so it's stable across old/new SQLMesh versions
28+
cp -r "$EXAMPLE_DIR" "$TEST_DIR"
29+
2730
git checkout $LAST_TAG
2831

2932
# Install dependencies from the previous release.
3033
make install-dev
3134

32-
cp -r $EXAMPLE_DIR $TEST_DIR
33-
3435
# this is only needed temporarily until the released tag for $LAST_TAG includes this config
3536
if [ "$EXAMPLE_NAME" == "sushi_dbt" ]; then
3637
echo 'migration_test_config = sqlmesh_config(Path(__file__).parent, dbt_target_name="duckdb")' >> $TEST_DIR/config.py
@@ -53,4 +54,4 @@ make install-dev
5354
pushd $TEST_DIR
5455
sqlmesh $SQLMESH_OPTS migrate
5556
sqlmesh $SQLMESH_OPTS diff prod
56-
popd
57+
popd

examples/sushi/models/customers.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ LEFT JOIN (
4242
ON o.customer_id = m.customer_id
4343
LEFT JOIN raw.demographics AS d
4444
ON o.customer_id = d.customer_id
45-
WHERE sushi.orders.customer_id > 0
45+
WHERE o.customer_id > 0

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]~=27.28.0",
27+
"sqlglot[rs]~=28.6.0",
2828
"tenacity",
2929
"time-machine",
3030
"json-stream"

sqlmesh/core/config/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ def init(cursor: t.Any) -> None:
23342334
for tpe in subclasses(
23352335
__name__,
23362336
ConnectionConfig,
2337-
exclude=(ConnectionConfig, BaseDuckDBConnectionConfig),
2337+
exclude={ConnectionConfig, BaseDuckDBConnectionConfig},
23382338
)
23392339
}
23402340

@@ -2343,7 +2343,7 @@ def init(cursor: t.Any) -> None:
23432343
for tpe in subclasses(
23442344
__name__,
23452345
ConnectionConfig,
2346-
exclude=(ConnectionConfig, BaseDuckDBConnectionConfig),
2346+
exclude={ConnectionConfig, BaseDuckDBConnectionConfig},
23472347
)
23482348
}
23492349

@@ -2355,7 +2355,7 @@ def init(cursor: t.Any) -> None:
23552355
for tpe in subclasses(
23562356
__name__,
23572357
ConnectionConfig,
2358-
exclude=(ConnectionConfig, BaseDuckDBConnectionConfig),
2358+
exclude={ConnectionConfig, BaseDuckDBConnectionConfig},
23592359
)
23602360
}
23612361

sqlmesh/core/config/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def get_default_catalog_per_gateway(self, context: GenericContext) -> t.Dict[str
146146

147147
SCHEDULER_CONFIG_TO_TYPE = {
148148
tpe.all_field_infos()["type_"].default: tpe
149-
for tpe in subclasses(__name__, BaseConfig, exclude=(BaseConfig,))
149+
for tpe in subclasses(__name__, BaseConfig, exclude={BaseConfig})
150150
}
151151

152152

sqlmesh/core/engine_adapter/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,7 +2861,7 @@ def _order_projections_and_filter(
28612861
return query
28622862

28632863
query = t.cast(exp.Query, query.copy())
2864-
with_ = query.args.pop("with", None)
2864+
with_ = query.args.pop("with_", None)
28652865

28662866
select_exprs: t.List[exp.Expression] = [
28672867
exp.column(c, quoted=True) for c in target_columns_to_types
@@ -2877,7 +2877,7 @@ def _order_projections_and_filter(
28772877
query = query.where(where, copy=False)
28782878

28792879
if with_:
2880-
query.set("with", with_)
2880+
query.set("with_", with_)
28812881

28822882
return query
28832883

sqlmesh/core/linter/rules/builtin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,4 @@ def check_model(self, model: Model) -> t.Optional[RuleViolation]:
318318
return None
319319

320320

321-
BUILTIN_RULES = RuleSet(subclasses(__name__, Rule, (Rule,)))
321+
BUILTIN_RULES = RuleSet(subclasses(__name__, Rule, exclude={Rule}))

sqlmesh/core/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ def _load_linting_rules(self) -> RuleSet:
840840
if os.path.getsize(path):
841841
self._track_file(path)
842842
module = import_python_file(path, self.config_path)
843-
module_rules = subclasses(module.__name__, Rule, (Rule,))
843+
module_rules = subclasses(module.__name__, Rule, exclude={Rule})
844844
for user_rule in module_rules:
845845
user_rules[user_rule.name] = user_rule
846846

sqlmesh/core/metric/rewriter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _build_sources(self, projections: t.List[exp.Expression]) -> SourceAggsAndJo
5757
return sources
5858

5959
def _expand(self, select: exp.Select) -> None:
60-
base = select.args["from"].this.find(exp.Table)
60+
base = select.args["from_"].this.find(exp.Table)
6161
base_alias = base.alias_or_name
6262
base_name = exp.table_name(base)
6363

sqlmesh/core/model/definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def ctas_query(self, **render_kwarg: t.Any) -> exp.Query:
753753
query = self.render_query_or_raise(**render_kwarg).limit(0)
754754

755755
for select_or_set_op in query.find_all(exp.Select, exp.SetOperation):
756-
if isinstance(select_or_set_op, exp.Select) and select_or_set_op.args.get("from"):
756+
if isinstance(select_or_set_op, exp.Select) and select_or_set_op.args.get("from_"):
757757
select_or_set_op.where(exp.false(), copy=False)
758758

759759
if self.managed_columns:

0 commit comments

Comments
 (0)