Skip to content

Commit 9584fda

Browse files
authored
Chore: detect xdb diff syntax and raise early (#4654)
1 parent 1735a20 commit 9584fda

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

docs/guides/tablediff.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ Then, specify each table's gateway in the `table_diff` command with this syntax:
253253
For example, we could diff the `landing.table` table across `bigquery` and `snowflake` gateways like this:
254254

255255
```sh
256-
$ sqlmesh table_diff 'bigquery|landing.table:snowflake|lake.table'
256+
$ tcloud sqlmesh table_diff 'bigquery|landing.table:snowflake|lake.table'
257257
```
258258

259259
This syntax tells SQLMesh to use the cross-database diffing algorithm instead of the normal within-database diffing algorithm.
260260

261-
After adding gateways to the table names, use `table_diff` as described above - the same options apply for specifying the join keys, decimal precision, etc. See `sqlmesh table_diff --help` for a [full list of options](../reference/cli.md#table_diff).
261+
After adding gateways to the table names, use `table_diff` as described above - the same options apply for specifying the join keys, decimal precision, etc. See `tcloud sqlmesh table_diff --help` for a [full list of options](../reference/cli.md#table_diff).
262262

263263
!!! warning
264264

@@ -273,7 +273,7 @@ A cross-database diff is broken up into two stages.
273273
The first stage is a schema diff. This example shows that differences in column name case across the two tables are identified as schema differences:
274274

275275
```bash
276-
$ sqlmesh table_diff 'bigquery|sqlmesh_example.full_model:snowflake|sqlmesh_example.full_model' --on item_id --show-sample
276+
$ tcloud sqlmesh table_diff 'bigquery|sqlmesh_example.full_model:snowflake|sqlmesh_example.full_model' --on item_id --show-sample
277277

278278
Schema Diff Between 'BIGQUERY|SQLMESH_EXAMPLE.FULL_MODEL' and 'SNOWFLAKE|SQLMESH_EXAMPLE.FULL_MODEL':
279279
├── Added Columns:

sqlmesh/core/context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,12 @@ def table_diff(
16771677
The list of TableDiff objects containing schema and summary differences.
16781678
"""
16791679

1680+
if "|" in source or "|" in target:
1681+
raise ConfigError(
1682+
"Cross-database table diffing is available in Tobiko Cloud. Read more here: "
1683+
"https://sqlmesh.readthedocs.io/en/stable/guides/tablediff/#diffing-tables-or-views-across-gateways"
1684+
)
1685+
16801686
table_diffs: t.List[TableDiff] = []
16811687

16821688
# Diffs multiple or a single model across two environments

0 commit comments

Comments
 (0)