Skip to content

Commit

Permalink
fix redshift stage when no hashed columns are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
tkiehn authored Sep 25, 2024
1 parent cd8e3a8 commit 4c154e7
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 4c154e7

Please sign in to comment.