Skip to content

Commit b42e6f9

Browse files
joellabesTimoKruthfivetran-joemarkiewiczdataderssean-rose
authored
dbt 0.7.4 release (#441)
* Update require-dbt-version to be 1.0 * Fix SQL 42000 on Exasol (#420) " SQL-Error [42000]: syntax error, unexpected '*' " If you specify the * in the unioned with their respectiv names <name>.* you do not receive the SQL Error posted above. This should not inflict any further problems since it is redundant for most DBs. * Minor readme link fixes (#431) * minor readme link fixes * changelog addition Co-authored-by: Joel Labes <joel.labes@dbtlabs.com> * 0.7.4 changelog (#432) * Update CHANGELOG.md * Note branch name change * use `limit_zero` macro instead of `limit 0` (#437) * Utils 0.7.4b1 (#433) * Update require-dbt-version to be 1.0 * Fix SQL 42000 on Exasol (#420) " SQL-Error [42000]: syntax error, unexpected '*' " If you specify the * in the unioned with their respectiv names <name>.* you do not receive the SQL Error posted above. This should not inflict any further problems since it is redundant for most DBs. * Minor readme link fixes (#431) * minor readme link fixes * changelog addition Co-authored-by: Joel Labes <joel.labes@dbtlabs.com> * 0.7.4 changelog (#432) * Update CHANGELOG.md * Note branch name change Co-authored-by: Timo Kruth <timo_kruth@gmx.de> Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> * standard convention * Update integration_tests/tests/jinja_helpers/test_slugify.sql Taking the liberty of committing on your behalf so that the CI job starts again * Change limit_zero to be a macro Co-authored-by: Joel Labes <joel.labes@dbtlabs.com> Co-authored-by: Timo Kruth <timo_kruth@gmx.de> Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> * Add col_name alias to else state too (#437) * Remove extra semicolon in `insert_by_period` materialization (#439) * Remove extra semicolon in `insert_by_period` materialization. `create_table_as()` generates a SQL statement that already ends with a semicolon, so the extra semicolon after a `create_table_as()` call in the `insert_by_period` materialization ends up being an empty SQL statement, and at least when using Snowflake this causes the dbt run to fail with a "cannot unpack non-iterable NoneType object" error. * Update changelog for PR 439. * Use the relation object passed into get_column_values, instead of making our own (#440) * Use the relation object passed into get_column_values, instead of making our own * Rename variables in get column value test to be clearer * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Timo Kruth <timo_kruth@gmx.de> Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Co-authored-by: Anders <swanson.anders@gmail.com> Co-authored-by: Sean Rose <sean.s.rose@gmail.com>
1 parent cfa8bdf commit b42e6f9

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

CHANGELOG.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
# dbt-utils v0.8.0
1+
# dbt-utils v0.7.4
2+
🚨 This is a compatibility release in preparation for `dbt-core` v1.0.0 (🎉). Projects using dbt-utils 0.7.4 with dbt-core v1.0.0 can expect to see a deprecation warning. This will be resolved in dbt_utils v0.8.0.
23

3-
# dbt-utils v0.7.4b1
4-
This is a compatibility release in preparation for `dbt-core` v1.0.0 (🎉). When dbt-core 1.0.0 hits release candidate status, we will release the final version of 0.7.4
4+
## Fixes
5+
- `get_column_values()` now works correctly with mixed-quoting styles on Snowflake ([#424](https://github.com/dbt-labs/dbt-utils/issues/424), [#440](https://github.com/dbt-labs/dbt-utils/pull/440))
6+
- Remove extra semicolon in `insert_by_period` materialization that was causing errors ([#439](https://github.com/dbt-labs/dbt-utils/pull/439))
7+
- Swap `limit 0` out for `{{ limit_zero() }}` on the `slugify()` tests to allow for compatibility with [tsql-utils](https://github.com/dbt-msft/tsql-utils) ([#437](https://github.com/dbt-labs/dbt-utils/pull/437))
58

6-
🚨 Projects using utils 0.7.4 with Core 1.0.0 can expect to see a deprecation warning. This will be resolved in 0.8.0 of dbt_utils alongside the final version of 1.0.0.
9+
## Contributors:
10+
- [sean-rose](https://github.com/sean-rose)
11+
- [@swanderz](https://github.com/swanderz)
712

13+
14+
# dbt-utils v0.7.4b1
815
:rotating_light:🚨 We have renamed the `master` branch to `main`. If you have a local version of `dbt-utils`, you will need to update to the new branch. See the [GitHub docs](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch#updating-a-local-clone-after-a-branch-name-changes) for more details.
916

1017
## Under the hood

integration_tests/models/sql/test_get_column_values.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
{% set columns = dbt_utils.get_column_values(ref('data_get_column_values'), 'field', default=[], order_by="field") %}
2+
{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values'), 'field', default=[], order_by="field") %}
33

44

55
{% if target.type == 'snowflake' %}
66

77
select
8-
{% for column in columns -%}
8+
{% for val in column_values -%}
99

10-
sum(case when field = '{{ column }}' then 1 else 0 end) as count_{{ column }}
10+
sum(case when field = '{{ val }}' then 1 else 0 end) as count_{{ val }}
1111
{%- if not loop.last %},{% endif -%}
1212

1313
{%- endfor %}
@@ -17,9 +17,9 @@ from {{ ref('data_get_column_values') }}
1717
{% else %}
1818

1919
select
20-
{% for column in columns -%}
20+
{% for val in column_values -%}
2121

22-
{{dbt_utils.safe_cast("sum(case when field = '" ~ column ~ "' then 1 else 0 end)", dbt_utils.type_string()) }} as count_{{ column }}
22+
{{dbt_utils.safe_cast("sum(case when field = '" ~ val ~ "' then 1 else 0 end)", dbt_utils.type_string()) }} as count_{{ val }}
2323
{%- if not loop.last %},{% endif -%}
2424

2525
{%- endfor %}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% if dbt_utils.slugify('!Hell0 world-hi') == 'hell0_world_hi' %}
22
{# Return 0 rows for the test to pass #}
3-
select 1 limit 0
3+
select 1 as col_name {{ limit_zero() }}
44
{% else %}
55
{# Return >0 rows for the test to fail #}
6-
select 1
6+
select 1 as col_name
77
{% endif %}

macros/materializations/insert_by_period_materialization.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
{# Create an empty target table -#}
103103
{% call statement('main') -%}
104104
{%- set empty_sql = sql | replace("__PERIOD_FILTER__", 'false') -%}
105-
{{create_table_as(False, target_relation, empty_sql)}};
105+
{{create_table_as(False, target_relation, empty_sql)}}
106106
{%- endcall %}
107107
{%- endif %}
108108

macros/sql/get_column_values.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
{{ return('') }}
1010
{% endif %}
1111

12-
{%- set target_relation = adapter.get_relation(database=table.database,
13-
schema=table.schema,
14-
identifier=table.identifier) -%}
12+
{# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}
13+
{# TODO: Change the method signature in a future 0.x.0 release #}
14+
{%- set target_relation = table -%}
1515

1616
{%- call statement('get_column_values', fetch_result=true) %}
1717

0 commit comments

Comments
 (0)