Skip to content

Commit

Permalink
Fix trino__drop_old_relations and trino__drop_schemas_by_prefixes
Browse files Browse the repository at this point in the history
… macros
  • Loading branch information
mdesmet authored and hovaesco committed May 25, 2022
1 parent 36634d8 commit c47b63b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions macros/dbt_utils/schema_cleanup/drop_old_relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
table_schema like '{{ target.schema }}%'
and table_name not in (
{%- for model in current_models -%}
'{{ model.upper() }}'
'{{ model }}'
{%- if not loop.last -%}
,
{% endif %}
Expand All @@ -35,7 +35,6 @@
from
models_to_drop
where
-- intentionally exclude unhandled table_types, including 'external table`
CONCAT( 'drop ' , relation_type , ' ' , relation_name , ';' ) is not null
{% endset %}

Expand Down
6 changes: 3 additions & 3 deletions macros/dbt_utils/schema_cleanup/drop_schemas_by_prefixes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
{# Fetch all schemas that use the current prefix #}
{% do log('Fetching schemas for ' + prefix + '...', info=True) %}
{% set schemas_table %}
select name
from sys.schemas
where name LIKE '{{prefix}}%'
select schema_name
from "{{ target.database }}"."information_schema"."schemata"
where schema_name LIKE '{{prefix}}%'
{% endset %}
{% set schema_names = run_query(schemas_table).columns[0].values() %}

Expand Down

0 comments on commit c47b63b

Please sign in to comment.