From 8e308d9a4b0717dcd1e83c30f3ea833ebc10f330 Mon Sep 17 00:00:00 2001 From: eakmanrq <6326532+eakmanrq@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:57:29 -0700 Subject: [PATCH] fix: ignore extra keys in node config --- sqlmesh/dbt/manifest.py | 18 +++++++++++------- tests/dbt/test_model.py | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sqlmesh/dbt/manifest.py b/sqlmesh/dbt/manifest.py index edb9004d6f..ca20554e3b 100644 --- a/sqlmesh/dbt/manifest.py +++ b/sqlmesh/dbt/manifest.py @@ -360,16 +360,20 @@ def _load_models_and_seeds(self) -> None: ) self._models_per_package[node.package_name][node_name] = ModelConfig( - sql=sql, - dependencies=dependencies, - tests=tests, - **node_config, + **dict( + node_config, + sql=sql, + dependencies=dependencies, + tests=tests, + ) ) else: self._seeds_per_package[node.package_name][node_name] = SeedConfig( - dependencies=Dependencies(macros=macro_references), - tests=tests, - **node_config, + **dict( + node_config, + dependencies=Dependencies(macros=macro_references), + tests=tests, + ) ) def _load_on_run_start_end(self) -> None: diff --git a/tests/dbt/test_model.py b/tests/dbt/test_model.py index 00361cf8b8..e33c41e68c 100644 --- a/tests/dbt/test_model.py +++ b/tests/dbt/test_model.py @@ -75,7 +75,8 @@ def test_load_invalid_ref_audit_constraints( dbt_project_dir.mkdir() dbt_model_dir = dbt_project_dir / "models" dbt_model_dir.mkdir() - full_model_contents = "SELECT 1 as cola" + # add `tests` to model config since this is loaded by dbt and ignored and we shouldn't error when loading it + full_model_contents = """{{ config(tags=["blah"], tests=[{"blah": {"to": "ref('completely_ignored')", "field": "blah2"} }]) }} SELECT 1 as cola""" full_model_file = dbt_model_dir / "full_model.sql" with open(full_model_file, "w", encoding="utf-8") as f: f.write(full_model_contents)