Skip to content

Commit

Permalink
Use adapter.quote() for get_table_types_sql (dbt-labs#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
alla-bongard authored Aug 16, 2022
1 parent 77dcf2e commit 830175f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions macros/sql/get_table_types_sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
when 'EXTERNAL TABLE' then 'external'
when 'MATERIALIZED VIEW' then 'materializedview'
else lower(table_type)
end as "table_type"
end as {{ adapter.quote('table_type') }}
{% endmacro %}


Expand All @@ -18,14 +18,5 @@
when 'FOREIGN' then 'external'
when 'MATERIALIZED VIEW' then 'materializedview'
else lower(table_type)
end as "table_type"
end as {{ adapter.quote('table_type') }}
{% endmacro %}

{% macro bigquery__get_table_types_sql() %}
case table_type
when 'BASE TABLE' then 'table'
when 'EXTERNAL TABLE' then 'external'
when 'MATERIALIZED VIEW' then 'materializedview'
else lower(table_type)
end as `table_type`
{% endmacro %}
4 changes: 2 additions & 2 deletions macros/sql/get_tables_by_pattern_sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}

select distinct
table_schema as "table_schema",
table_name as "table_name",
table_schema as {{ adapter.quote('table_schema') }},
table_name as {{ adapter.quote('table_name') }},
{{ dbt_utils.get_table_types_sql() }}
from {{ database }}.information_schema.tables
where table_schema ilike '{{ schema_pattern }}'
Expand Down

0 comments on commit 830175f

Please sign in to comment.