Skip to content

Commit 702361b

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

File tree

2 files changed

+4
-49
lines changed

2 files changed

+4
-49
lines changed

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)