Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package and model name in surrogate_key warning #258

Merged
merged 3 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions macros/cross_db_utils/identifier.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% macro identifier(value) %}
{% do exceptions.warn("Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use `adapter.quote` instead") %}
{%- set error_message = '
Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \
Use `adapter.quote` instead. The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}
{%- do exceptions.warn(error_message) -%}
{{ adapter_macro('dbt_utils.identifier', value) }}
{% endmacro %}

Expand All @@ -9,4 +13,4 @@

{% macro bigquery__identifier(value) -%}
`{{ value }}`
{%- endmacro %}
{%- endmacro %}
8 changes: 6 additions & 2 deletions macros/sql/get_relations_by_prefix.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
{% endmacro %}

{% macro get_tables_by_prefix(schema, prefix, exclude='', database=target.database) %}

{% do exceptions.warn("Warning: the `get_tables_by_prefix` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `get_relations_by_prefix` macro instead") %}
{%- set error_message = '
Warning: the `get_tables_by_prefix` macro is no longer supported and will be deprecated in a future release of dbt-utils. \
Use the `get_relations_by_prefix` macro instead. \
The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}
{%- do exceptions.warn(error_message) -%}

{{ return(dbt_utils.get_relations_by_prefix(schema, prefix, exclude, database)) }}

Expand Down
8 changes: 7 additions & 1 deletion macros/sql/surrogate_key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

{%- if varargs|length >= 1 or field_list is string %}

{%- do exceptions.warn("Warning: the `surrogate_key` macro now takes a single list argument instead of multiple string arguments. Support for multiple string arguments will be deprecated in a future release of dbt-utils.") -%}
{%- set error_message = '
Warning: the `surrogate_key` macro now takes a single list argument instead of \
multiple string arguments. Support for multiple string arguments will be \
deprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}

{%- do exceptions.warn(error_message) -%}

{# first argument is not included in varargs, so add first element to field_list_xf #}
{%- set field_list_xf = [field_list] -%}
Expand Down
8 changes: 6 additions & 2 deletions macros/sql/union.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@
{%- endmacro -%}

{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}

{%- do exceptions.warn("Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead") -%}
{%- set error_message = '
Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. \
Use the `union_relations` macro instead. \
The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}
{%- do exceptions.warn(error_message) -%}

{{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}

Expand Down
7 changes: 6 additions & 1 deletion macros/sql/unpivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ Arguments:
{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}

{% if table %}
{% do exceptions.warn("Warning: the `unpivot` macro no longer accepts a `table` parameter. This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead") %}
{%- set error_message = '
Warning: the `unpivot` macro no longer accepts a `table` parameter. \
This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \
The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}
{%- do exceptions.warn(error_message) -%}
{% endif %}

{% if relation and table %}
Expand Down