Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@jthandy @jtcohen6
20 lines (12 sloc) 369 Bytes
{%- macro surrogate_key() -%}
{% set fields = [] %}
{%- for field in varargs -%}
{% set _ = fields.append(
"coalesce(cast(" ~ field ~ " as " ~ dbt_utils.type_string() ~ "), '')"
) %}
{% if not loop.last %}
{% set _ = fields.append("'-'") %}
{% endif %}
{%- endfor -%}
{{dbt_utils.hash(dbt_utils.concat(fields))}}
{%- endmacro -%}
You can’t perform that action at this time.