Skip to content

Commit 1057d0c

Browse files
committed
Remove deprecated table argument from unpivot()
resolves #670
1 parent 064c2ab commit 1057d0c

File tree

3 files changed

+8
-49
lines changed

3 files changed

+8
-49
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
## New features
1414
- New feature to omit the `source_column_name` column on the `union_relations` macro ([#331](https://github.com/dbt-labs/dbt-utils/issues/331), [#624](https://github.com/dbt-labs/dbt-utils/pull/624))
1515

16+
## Under the hood
17+
- Remove deprecated table argument from unpivot ([#671](https://github.com/dbt-labs/dbt-utils/pull/671))
18+
1619
## Fixes
1720
- Better handling of whitespaces in the star macro ([#651](https://github.com/dbt-labs/dbt-utils/pull/651))
1821
- Fix to correct behavior in `mutually_exclusive_ranges` test in certain situations when `zero_length_range_allowed: true` and multiple ranges in a partition have the same value for `lower_bound_column`. ([[#659](https://github.com/dbt-labs/dbt-utils/issues/659)], [#660](https://github.com/dbt-labs/dbt-utils/pull/660))
@@ -21,6 +24,7 @@
2124
- [@christineberger](https://github.com/christineberger) (#624)
2225
- [@courentin](https://github.com/courentin) (#651)
2326
- [@sfc-gh-ancoleman](https://github.com/sfc-gh-ancoleman) (#660)
27+
- [@miles170](https://github.com/miles170) (#671)
2428

2529
# dbt-utils v0.8.6
2630

integration_tests/models/sql/test_unpivot_original_api.sql

-32
This file was deleted.

macros/sql/unpivot.sql

+4-17
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,13 @@ Arguments:
1212
value_name: Destination table column name for the pivoted values
1313
#}
1414

15-
{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}
16-
{{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}
15+
{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}
16+
{{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}
1717
{% endmacro %}
1818

19-
{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}
19+
{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}
2020

21-
{% if table %}
22-
{%- set error_message = '
23-
Warning: the `unpivot` macro no longer accepts a `table` parameter. \
24-
This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \
25-
The {}.{} model triggered this warning. \
26-
'.format(model.package_name, model.name) -%}
27-
{%- do exceptions.warn(error_message) -%}
28-
{% endif %}
29-
30-
{% if relation and table %}
31-
{{ exceptions.raise_compiler_error("Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).") }}
32-
{% elif not relation and table %}
33-
{% set relation=table %}
34-
{% elif not relation and not table %}
21+
{% if not relation %}
3522
{{ exceptions.raise_compiler_error("Error: argument `relation` is required for `unpivot` macro.") }}
3623
{% endif %}
3724

0 commit comments

Comments
 (0)