Skip to content

Commit f43a4c3

Browse files
authored
Fix(table_diff): Ignore unexpected arguments instead of throwing an error (#4846)
1 parent e07c5fe commit f43a4c3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

sqlmesh/core/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,7 @@ def table_diff(
16791679
warn_grain_check: bool = False,
16801680
temp_schema: t.Optional[str] = None,
16811681
schema_diff_ignore_case: bool = False,
1682+
**kwargs: t.Any, # catch-all to prevent an 'unexpected keyword argument' error if an table_diff extension passes in some extra arguments
16821683
) -> t.List[TableDiff]:
16831684
"""Show a diff between two tables.
16841685

tests/core/test_context.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,3 +2304,17 @@ def test_dev_environment_virtual_update_with_environment_statements(tmp_path: Pa
23042304
updated_statements[0].before_all[1]
23052305
== "CREATE TABLE IF NOT EXISTS metrics (metric_name VARCHAR(50), value INT)"
23062306
)
2307+
2308+
2309+
def test_table_diff_ignores_extra_args(sushi_context: Context):
2310+
sushi_context.plan(environment="dev", auto_apply=True, include_unmodified=True)
2311+
2312+
# the test fails if this call throws an exception
2313+
sushi_context.table_diff(
2314+
source="prod",
2315+
target="dev",
2316+
select_models=["sushi.customers"],
2317+
on=["customer_id"],
2318+
show_sample=True,
2319+
some_tcloud_option=1_000,
2320+
)

0 commit comments

Comments
 (0)