From 6df3ba8f7d081ba1e3c87116e8e59f71f69b40fa Mon Sep 17 00:00:00 2001 From: Jochem van Dooren Date: Mon, 16 Dec 2024 09:23:54 +0100 Subject: [PATCH] Get test_metadata optionally everywhere --- src/dbt_score/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dbt_score/models.py b/src/dbt_score/models.py index ef55b89..0026794 100644 --- a/src/dbt_score/models.py +++ b/src/dbt_score/models.py @@ -141,7 +141,10 @@ def _get_columns( [ test for test in test_values - if test["test_metadata"]["kwargs"].get("column_name") == name + if test.get("test_metadata", {}) + .get("kwargs", {}) + .get("column_name") + == name ], ) for name, values in node_values.get("columns", {}).items() @@ -224,7 +227,9 @@ def from_node( tests=[ Test.from_node(test) for test in test_values - if not test["test_metadata"]["kwargs"].get("column_name") + if not test.get("test_metadata", {}) + .get("kwargs", {}) + .get("column_name") ], depends_on=node_values["depends_on"], _raw_values=node_values,