Skip to content

Commit 4555847

Browse files
Fix column test matching when using quotes in BigQuery (#122)
I noticed the following issue in BigQuery, when using models where a column has "quote: true" defined. In that case the data_tests defined for that column were not matched to that node. Consequently the test has_uniqueness_test failed. When looking into the dbt manifest I saw that in the test node at test_metadata.kwargs.column_name the name contained the quotes (with grave accent `), e.g. ``` "column_name": "`my_column`" ``` However at the model node it is always without the quotes, e.g. ``` "columns": { "my_column": { "name": "my_column" ``` --------- Co-authored-by: Matthieu Caneill <[email protected]>
1 parent fde03ee commit 4555847

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to
99
## [Unreleased]
1010

1111
- Support linting of exposures (#112)
12+
- Fix retrieval of data_tests when using quoted columns in BigQuery (#122)
1213

1314
## [0.12.0] - 2025-05-06
1415

src/dbt_score/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def _get_columns(
146146
for test in test_values
147147
if test.get("test_metadata", {})
148148
.get("kwargs", {})
149-
.get("column_name")
149+
.get("column_name", "")
150+
.strip("`") # BigQuery connector when "quote: true"
150151
== name
151152
],
152153
)

0 commit comments

Comments
 (0)