Skip to content

Commit

Permalink
dbt 0.7.4 release (#441)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>

* 0.7.4 changelog (#432)

* Update CHANGELOG.md

* Note branch name change

Co-authored-by: Timo Kruth <[email protected]>
Co-authored-by: Joe Markiewicz <[email protected]>

* 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 <[email protected]>
Co-authored-by: Timo Kruth <[email protected]>
Co-authored-by: Joe Markiewicz <[email protected]>

* 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 <[email protected]>
Co-authored-by: Joe Markiewicz <[email protected]>
Co-authored-by: Anders <[email protected]>
Co-authored-by: Sean Rose <[email protected]>
  • Loading branch information
5 people authored Nov 11, 2021
1 parent cfa8bdf commit b42e6f9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# dbt-utils v0.8.0
# dbt-utils v0.7.4
🚨 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.

# dbt-utils v0.7.4b1
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
## Fixes
- `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))
- Remove extra semicolon in `insert_by_period` materialization that was causing errors ([#439](https://github.com/dbt-labs/dbt-utils/pull/439))
- 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))

🚨 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.
## Contributors:
- [sean-rose](https://github.com/sean-rose)
- [@swanderz](https://github.com/swanderz)


# dbt-utils v0.7.4b1
: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.

## Under the hood
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/models/sql/test_get_column_values.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

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


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

select
{% for column in columns -%}
{% for val in column_values -%}

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

{%- endfor %}
Expand All @@ -17,9 +17,9 @@ from {{ ref('data_get_column_values') }}
{% else %}

select
{% for column in columns -%}
{% for val in column_values -%}

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

{%- endfor %}
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/tests/jinja_helpers/test_slugify.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if dbt_utils.slugify('!Hell0 world-hi') == 'hell0_world_hi' %}
{# Return 0 rows for the test to pass #}
select 1 limit 0
select 1 as col_name {{ limit_zero() }}
{% else %}
{# Return >0 rows for the test to fail #}
select 1
select 1 as col_name
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
{# Create an empty target table -#}
{% call statement('main') -%}
{%- set empty_sql = sql | replace("__PERIOD_FILTER__", 'false') -%}
{{create_table_as(False, target_relation, empty_sql)}};
{{create_table_as(False, target_relation, empty_sql)}}
{%- endcall %}
{%- endif %}

Expand Down
6 changes: 3 additions & 3 deletions macros/sql/get_column_values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
{{ return('') }}
{% endif %}

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

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

Expand Down

0 comments on commit b42e6f9

Please sign in to comment.