Skip to content

Commit

Permalink
Merge pull request #94 from Oracen/main
Browse files Browse the repository at this point in the history
DB name escape fix
  • Loading branch information
sdebruyn authored Sep 7, 2024
2 parents 81ee66d + 76848b8 commit 18a822f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.vscode
target/
dbt_modules/
logs/
Expand Down
2 changes: 1 addition & 1 deletion macros/dbt_utils/schema_cleanup/drop_old_relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ELSE concat_ws('.', table_catalog, table_schema, table_name)
END as relation_name
from
"{{ target.database }}".information_schema.tables -- Added quotes for any whitespace in target db
[{{ target.database }}].information_schema.tables -- Escape DB name
where
table_schema like '{{ target.schema }}%'
and table_name not in (
Expand Down
5 changes: 3 additions & 2 deletions macros/dbt_utils/sql/get_tables_by_pattern_sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

SELECT DISTINCT
table_schema AS "table_schema",
table_name AS "table_name"
FROM {{database}}.information_schema.tables
table_name AS "table_name",
{{ dbt_utils.get_table_types_sql() }}
FROM [{{database}}].information_schema.tables -- Escape DB name
WHERE table_schema LIKE '{{ schema_pattern }}'
AND table_name LIKE '{{ table_pattern }}'
AND table_name NOT LIKE '{{ exclude }}'
Expand Down

0 comments on commit 18a822f

Please sign in to comment.