forked from dbt-labs/dbt-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurrogate_key.sql
More file actions
20 lines (16 loc) · 798 Bytes
/
surrogate_key.sql
File metadata and controls
20 lines (16 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{%- macro surrogate_key(field_list) -%}
{% set frustrating_jinja_feature = varargs %}
{{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}
{% endmacro %}
{%- macro default__surrogate_key(field_list) -%}
{%- set error_message = '
Warning: `dbt_utils.surrogate_key` has been replaced by \
`dbt_utils.generate_surrogate_key`. The new macro treats null values \
differently to empty strings. To restore the behaviour of the original \
macro, add a variable scoped to the dbt_utils package called \
`surrogate_key_treat_nulls_as_empty_strings` to your \
dbt_project.yml file with a value of True. \
The {}.{} model triggered this warning. \
'.format(model.package_name, model.name) -%}
{%- do exceptions.raise_compiler_error(error_message) -%}
{%- endmacro -%}