Skip to content

Commit

Permalink
Merge pull request #259 from ScalefreeCOM/fix-redshift-stage-with-no-…
Browse files Browse the repository at this point in the history
…hashed-columns

fix redshift stage compilation error when no hashed columns are provided
  • Loading branch information
tkiehn authored Sep 27, 2024
2 parents 3407863 + 4c154e7 commit 49a7eb2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions macros/staging/redshift/stage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,15 @@ derived_columns AS (
{%- else -%}
{%- set derived_columns_dict = [] -%}
{%- endif -%}
{%- for hash_column_key in hashed_columns.keys() -%}
{%- if hashed_columns[hash_column_key] is mapping -%}
{%- do hashed_columns[hash_column_key].update({'columns': datavault4dbt.get_field_hash_by_datatype(hashed_columns=hashed_columns[hash_column_key]['columns'], all_datatype_columns=all_columns, derived_columns=derived_columns_dict)}) -%}
{%- elif datavault4dbt.is_list(hashed_columns[hash_column_key]) -%}
{%- do hashed_columns.update({hash_column_key: datavault4dbt.get_field_hash_by_datatype(hashed_columns=hashed_columns[hash_column_key], all_datatype_columns=all_columns, derived_columns=derived_columns_dict)}) -%}
{%- endif -%}
{%- endfor -%}
{%- if datavault4dbt.is_something(hashed_columns) %}
{%- for hash_column_key in hashed_columns.keys() -%}
{%- if hashed_columns[hash_column_key] is mapping -%}
{%- do hashed_columns[hash_column_key].update({'columns': datavault4dbt.get_field_hash_by_datatype(hashed_columns=hashed_columns[hash_column_key]['columns'], all_datatype_columns=all_columns, derived_columns=derived_columns_dict)}) -%}
{%- elif datavault4dbt.is_list(hashed_columns[hash_column_key]) -%}
{%- do hashed_columns.update({hash_column_key: datavault4dbt.get_field_hash_by_datatype(hashed_columns=hashed_columns[hash_column_key], all_datatype_columns=all_columns, derived_columns=derived_columns_dict)}) -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}

{%- if datavault4dbt.is_something(hashed_columns) and hashed_columns is mapping %}
Expand Down

0 comments on commit 49a7eb2

Please sign in to comment.