From 0320e9bd5d03e389d0ec459155c29c216237ae7c Mon Sep 17 00:00:00 2001 From: Erin Drummond Date: Mon, 30 Jun 2025 02:37:59 +0000 Subject: [PATCH] Fix(table_diff): Ignore unexpected arguments instead of throwing an error --- sqlmesh/core/context.py | 1 + tests/core/test_context.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/sqlmesh/core/context.py b/sqlmesh/core/context.py index d7aa873394..0317aad894 100644 --- a/sqlmesh/core/context.py +++ b/sqlmesh/core/context.py @@ -1679,6 +1679,7 @@ def table_diff( warn_grain_check: bool = False, temp_schema: t.Optional[str] = None, schema_diff_ignore_case: bool = False, + **kwargs: t.Any, # catch-all to prevent an 'unexpected keyword argument' error if an table_diff extension passes in some extra arguments ) -> t.List[TableDiff]: """Show a diff between two tables. diff --git a/tests/core/test_context.py b/tests/core/test_context.py index 213c4cec2b..8922472aa3 100644 --- a/tests/core/test_context.py +++ b/tests/core/test_context.py @@ -2304,3 +2304,17 @@ def test_dev_environment_virtual_update_with_environment_statements(tmp_path: Pa updated_statements[0].before_all[1] == "CREATE TABLE IF NOT EXISTS metrics (metric_name VARCHAR(50), value INT)" ) + + +def test_table_diff_ignores_extra_args(sushi_context: Context): + sushi_context.plan(environment="dev", auto_apply=True, include_unmodified=True) + + # the test fails if this call throws an exception + sushi_context.table_diff( + source="prod", + target="dev", + select_models=["sushi.customers"], + on=["customer_id"], + show_sample=True, + some_tcloud_option=1_000, + )