Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix: added missing commas in staging for when include_source_columns …
Browse files Browse the repository at this point in the history
…= false
  • Loading branch information
balmasi committed Feb 2, 2021
1 parent 869feb9 commit 8f01acc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions macros/staging/stage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,20 @@ SELECT
{% if hashed_columns is defined and hashed_columns is not none -%}
{# BQ Customization: Passing hash_algo to hash_columns #}
{{ dbtvault_bq.hash_columns(hashed_columns, hash_algo) -}}
{# BQ Fixed: https://github.com/Datavault-UK/dbtvault/issues/17 #}
{{ "," if derived_columns is defined and source_relation is defined }}
{% endif -%}

{#- Derive additional columns, if provided -#}
{%- if derived_columns is defined and derived_columns is not none -%}
{%- if include_source_columns -%}
{# BQ FIX: Added comma to fix missing comma when include_source_columns = false #}
,{%- if include_source_columns -%}
{{ dbtvault.snowflake__derive_columns(source_relation=source_relation, columns=derived_columns) }}
{%- else -%}
{{ dbtvault.snowflake__derive_columns(columns=derived_columns) }}
{%- endif -%}
{#- If source relation is defined but derived_columns is not, add columns from source model. -#}
{%- elif source_relation is defined and include_source_columns is true -%}

{{ dbtvault.snowflake__derive_columns(source_relation=source_relation) }}
{# BQ FIX: Added comma to fix missing comma when include_source_columns = false #}
,{{ dbtvault.snowflake__derive_columns(source_relation=source_relation) }}
{%- endif %}

FROM {{ source_relation }}
Expand Down

0 comments on commit 8f01acc

Please sign in to comment.