diff --git a/CHANGELOG.md b/CHANGELOG.md index c9046d7f..5bb4df53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + # dbt-utils v0.8.3 ## New features - A macro for deduplicating data ([#335](https://github.com/dbt-labs/dbt-utils/issues/335), [#512](https://github.com/dbt-labs/dbt-utils/pull/512)) diff --git a/README.md b/README.md index ae922a1f..acc7c825 100644 --- a/README.md +++ b/README.md @@ -383,7 +383,6 @@ models: Additional `gaps` and `zero_length_range_allowed` examples **Understanding the `gaps` argument:** - Here are a number of examples for each allowed `gaps` argument. * `gaps: not_allowed`: The upper bound of one record must be the lower bound of the next record. @@ -787,7 +786,7 @@ from {{ ref('my_model') }} This macro unions together an array of [Relations](https://docs.getdbt.com/docs/writing-code-in-dbt/class-reference/#relation), even when columns have differing orders in each Relation, and/or some columns are missing from some relations. Any columns exclusive to a subset of these -relations will be filled with `null` where not present. An new column +relations will be filled with `null` where not present. A new column (`_dbt_source_relation`) is also added to indicate the source for each record. **Usage:** diff --git a/macros/sql/get_relations_by_pattern.sql b/macros/sql/get_relations_by_pattern.sql index 9325a883..aed8bd60 100644 --- a/macros/sql/get_relations_by_pattern.sql +++ b/macros/sql/get_relations_by_pattern.sql @@ -19,7 +19,7 @@ database=database, schema=row.table_schema, identifier=row.table_name, - type=row.table_type + type = row.table_type ) -%} {%- do tbl_relations.append(tbl_relation) -%} {%- endfor -%} diff --git a/macros/sql/get_table_types_sql.sql b/macros/sql/get_table_types_sql.sql index e3f86884..c16275e9 100644 --- a/macros/sql/get_table_types_sql.sql +++ b/macros/sql/get_table_types_sql.sql @@ -8,7 +8,7 @@ when 'EXTERNAL TABLE' then 'external' when 'MATERIALIZED VIEW' then 'materializedview' else lower(table_type) - end as "table_type" + end as table_type {% endmacro %} diff --git a/macros/sql/get_tables_by_pattern_sql.sql b/macros/sql/get_tables_by_pattern_sql.sql index 93f3c6a6..4d5a8fc9 100644 --- a/macros/sql/get_tables_by_pattern_sql.sql +++ b/macros/sql/get_tables_by_pattern_sql.sql @@ -30,10 +30,7 @@ select distinct table_schema, table_name, - case table_type - when 'BASE TABLE' then 'table' - else lower(table_type) - end as table_type + {{ dbt_utils.get_table_types_sql() }} from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES where lower(table_name) like lower ('{{ table_pattern }}')