Skip to content

Commit 8e308d9

Browse files
committed
fix: ignore extra keys in node config
1 parent 4e2dd29 commit 8e308d9

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

sqlmesh/dbt/manifest.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,20 @@ def _load_models_and_seeds(self) -> None:
360360
)
361361

362362
self._models_per_package[node.package_name][node_name] = ModelConfig(
363-
sql=sql,
364-
dependencies=dependencies,
365-
tests=tests,
366-
**node_config,
363+
**dict(
364+
node_config,
365+
sql=sql,
366+
dependencies=dependencies,
367+
tests=tests,
368+
)
367369
)
368370
else:
369371
self._seeds_per_package[node.package_name][node_name] = SeedConfig(
370-
dependencies=Dependencies(macros=macro_references),
371-
tests=tests,
372-
**node_config,
372+
**dict(
373+
node_config,
374+
dependencies=Dependencies(macros=macro_references),
375+
tests=tests,
376+
)
373377
)
374378

375379
def _load_on_run_start_end(self) -> None:

tests/dbt/test_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def test_load_invalid_ref_audit_constraints(
7575
dbt_project_dir.mkdir()
7676
dbt_model_dir = dbt_project_dir / "models"
7777
dbt_model_dir.mkdir()
78-
full_model_contents = "SELECT 1 as cola"
78+
# add `tests` to model config since this is loaded by dbt and ignored and we shouldn't error when loading it
79+
full_model_contents = """{{ config(tags=["blah"], tests=[{"blah": {"to": "ref('completely_ignored')", "field": "blah2"} }]) }} SELECT 1 as cola"""
7980
full_model_file = dbt_model_dir / "full_model.sql"
8081
with open(full_model_file, "w", encoding="utf-8") as f:
8182
f.write(full_model_contents)

0 commit comments

Comments
 (0)