Skip to content

Commit 2bbf1dc

Browse files
authored
Merge branch 'main' into fix/snowflake-alter-session-quoting
2 parents 637af55 + c0026dc commit 2bbf1dc

18 files changed

Lines changed: 899 additions & 119 deletions

File tree

‎.github/workflows/pr.yaml‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
python: ${{ steps.filter.outputs.python }}
1818
client: ${{ steps.filter.outputs.client }}
1919
vscode: ${{ steps.filter.outputs.vscode }}
20+
lsp: ${{ steps.filter.outputs.lsp }}
2021
ci: ${{ steps.filter.outputs.ci }}
2122
steps:
2223
- uses: actions/checkout@v7
@@ -37,6 +38,8 @@ jobs:
3738
- 'web/client/**'
3839
vscode:
3940
- 'vscode/**'
41+
lsp:
42+
- 'sqlmesh/lsp/**'
4043
ci:
4144
- '.github/**'
4245
- 'Makefile'
@@ -427,10 +430,12 @@ jobs:
427430
- name: Run CI
428431
run: pnpm run ci
429432
test-vscode-e2e:
430-
runs-on:
431-
labels: [ubuntu-2204-8]
432-
# As at 2026-01-12 this job flakes 100% of the time. It needs investigation
433-
if: false
433+
needs: changes
434+
if:
435+
needs.changes.outputs.vscode == 'true' || needs.changes.outputs.lsp ==
436+
'true' || needs.changes.outputs.ci == 'true' || github.ref ==
437+
'refs/heads/main'
438+
runs-on: ubuntu-latest
434439
steps:
435440
- uses: actions/checkout@v7
436441
- uses: actions/setup-node@v7
@@ -453,7 +458,9 @@ jobs:
453458
source .venv/bin/activate
454459
make install-dev
455460
- name: Install code-server
456-
run: curl -fsSL https://code-server.dev/install.sh | sh
461+
# Pinned so that a code-server release cannot change the editor UI the
462+
# tests drive without the change showing up here first.
463+
run: curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.137.0
457464
- name: Install Playwright browsers
458465
working-directory: ./vscode/extension
459466
run: pnpm exec playwright install

‎Makefile‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ engine-up: engine-clickhouse-up engine-mssql-up engine-mysql-up engine-postgres-
132132
engine-down: engine-clickhouse-down engine-mssql-down engine-mysql-down engine-postgres-down engine-spark-down engine-trino-down
133133

134134
fast-test:
135-
pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
135+
pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated and not slow" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
136136

137137
slow-test:
138-
pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
138+
pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
139139

140140
cicd-test:
141-
pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
141+
pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and not pyspark and fork_isolated" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and not pyspark and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated"
142142

143143
core-fast-test:
144144
pytest -n auto -m "fast and not web and not github and not dbt and not jupyter"

‎docs/integrations/engines/clickhouse.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ In general, you must be connected to a ClickHouse server to execute commands. By
4949

5050
To associate an object with a cluster, DDL commands that create or modify it must include the text `ON CLUSTER [your cluster name]`.
5151

52-
If you provide a cluster name in your SQLMesh connection configuration, SQLMesh will automatically inject the `ON CLUSTER` statement into the DDL commands for all objects created while executing the project. We provide more information about clusters in SQLMesh [below](#cluster-specification).
52+
If you provide a cluster name in your SQLMesh connection configuration, SQLMesh automatically adds `ON CLUSTER` to object DDL, except for metadata DDL targeting `Replicated` databases, which replicate those changes themselves. We provide more information about clusters in SQLMesh [below](#cluster-specification).
5353

5454
#### ClickHouse Cloud mode
5555

@@ -96,7 +96,9 @@ For example, we could create a table `my_schema.my_table` on cluster `TheCluster
9696

9797
To create SQLMesh objects on a cluster, provide the cluster name to the `cluster` key in the SQLMesh connection definition (see all connection parameters [below](#localbuilt-in-scheduler)).
9898

99-
SQLMesh will automatically inject the `ON CLUSTER` clause and cluster name you provide into all project DDL statements.
99+
SQLMesh automatically adds the `ON CLUSTER` clause and cluster name you provide to object DDL, except for metadata DDL targeting `Replicated` databases. SQLMesh retains `ON CLUSTER` for database creation and removal and for partition operations.
100+
101+
Partition overwrites in multi-shard `Replicated` databases remain unvalidated. ClickHouse can replicate an ALTER containing both `REPLACE PARTITION` and `DROP PARTITION`, which can conflict with `ON CLUSTER`. This behavior predates the metadata DDL policy described above and depends on the ClickHouse version.
100102

101103
## Model definition
102104

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ markers = [
257257
"remote: test that involves interacting with a remote DB",
258258
"cicdonly: test that only runs on CI/CD",
259259
"isolated: tests that need to run sequentially usually because they use fork",
260+
"fork_isolated: tests that need their own fresh pytest process because they use fork",
260261
"dialect_isolated: tests that need to run separately due to global dialect overrides",
261262

262263
# Test Domain Markers

‎sqlmesh/core/engine_adapter/base.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,12 +1043,15 @@ def _build_create_table_exp(
10431043
) -> exp.Create:
10441044
exists = False if replace else exists
10451045
catalog_name = None
1046+
target_table: t.Optional[exp.Table] = None
10461047
if not isinstance(table_name_or_schema, exp.Schema):
10471048
table_name_or_schema = exp.to_table(table_name_or_schema)
10481049
catalog_name = table_name_or_schema.catalog
1050+
target_table = table_name_or_schema
10491051
else:
10501052
if isinstance(table_name_or_schema.this, exp.Table):
10511053
catalog_name = table_name_or_schema.this.catalog
1054+
target_table = table_name_or_schema.this
10521055

10531056
properties = (
10541057
self._build_table_properties_exp(
@@ -1057,6 +1060,9 @@ def _build_create_table_exp(
10571060
target_columns_to_types=target_columns_to_types,
10581061
table_description=table_description,
10591062
table_kind=table_kind,
1063+
# Passed so an adapter can vary properties by target object, not just by
1064+
# connection. Additive: every override accepts **kwargs.
1065+
table=target_table,
10601066
)
10611067
if kwargs or table_description
10621068
else None
@@ -1364,6 +1370,8 @@ def create_view(
13641370
else None
13651371
),
13661372
physical_cluster=create_kwargs.pop("physical_cluster", None),
1373+
# See the note on the table-properties call site above.
1374+
table=exp.to_table(view_name),
13671375
)
13681376
if create_view_properties:
13691377
for view_property in create_view_properties.expressions:

0 commit comments

Comments
 (0)