Skip to content

Commit

Permalink
Merge pull request #509 from dbt-labs/dc/regex-coverage-haha
Browse files Browse the repository at this point in the history
make sure we catch single character dbs and schemas
  • Loading branch information
dave-connors-3 authored Oct 25, 2024
2 parents 95297ea + bee9393 commit 0417914
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion integration_tests/models/marts/fct_model_6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ select 1 as id
select
5 as id
from {{ var('my_table_reference', 'table_d') }}

union all
select
5 as id
from a.b.c
union all
select
5 as id
from a.b

#}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
model,hard_coded_references
fct_model_6,"""my_db"".""my_schema"".""my_table"", ""my_schema"".""raw_relation_5"", ""raw_relation_2"", 'my_db'.'my_schema'.'my_table', 'my_schema'.'raw_relation_5', 'raw_relation_4', [my_db].[my_schema].[my_table], [my_schema].[raw_relation_5], [raw_relation_3], `my_db`.`my_schema`.`my_table`, `my_schema`.`raw_relation_5`, `project-name.dataset_name.table_name`, `raw_relation_1`, my_db.my_schema.my_table, my_schema.raw_relation_5, {{ var(""my_table_reference"") }}, {{ var(""my_table_reference"", ""table_d"") }}, {{ var('my_table_reference') }}, {{ var('my_table_reference', 'table_d') }}"
fct_model_6,"""my_db"".""my_schema"".""my_table"", ""my_schema"".""raw_relation_5"", ""raw_relation_2"", 'my_db'.'my_schema'.'my_table', 'my_schema'.'raw_relation_5', 'raw_relation_4', [my_db].[my_schema].[my_table], [my_schema].[raw_relation_5], [raw_relation_3], `my_db`.`my_schema`.`my_table`, `my_schema`.`raw_relation_5`, `project-name.dataset_name.table_name`, `raw_relation_1`, a.b, a.b.c, my_db.my_schema.my_table, my_schema.raw_relation_5, {{ var(""my_table_reference"") }}, {{ var(""my_table_reference"", ""table_d"") }}, {{ var('my_table_reference') }}, {{ var('my_table_reference', 'table_d') }}"
10 changes: 5 additions & 5 deletions macros/find_all_hard_coded_references.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
# third matching group
# at least 1 word character
(\w+-?\w+)
(\w+-?\w*)
# fouth matching group
# 1 or 0 of (closing bracket, backtick, or quotation mark)
Expand All @@ -150,7 +150,7 @@
# seventh matching group
# at least 1 word character
(\w+-?\w+)
(\w+-?\w*)
# eighth matching group
# 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string
Expand All @@ -173,7 +173,7 @@
# third matching group
# at least 1 word character
(\w+-?\w+)
(\w+-?\w*)
# fouth matching group
# 1 or 0 of (closing bracket, backtick, or quotation mark)
Expand All @@ -189,7 +189,7 @@
# seventh matching group
# at least 1 word character
(\w+-?\w+)
(\w+-?\w*)
# eighth matching group
# 1 or 0 of (closing bracket, backtick, or quotation mark)
Expand All @@ -205,7 +205,7 @@
# eleventh matching group
# at least 1 word character
(\w+-?\w+)
(\w+-?\w*)
# twelfth matching group
# 1 or 0 of (closing bracket, backtick, or quotation mark) followed by a whitespace character or end of string
Expand Down

0 comments on commit 0417914

Please sign in to comment.