Skip to content

Commit

Permalink
Merge pull request #77 from emnify/main
Browse files Browse the repository at this point in the history
Convert data type of column json_feature (attributes) from json to SUPER for Redshift
  • Loading branch information
bcodell authored Jan 2, 2025
2 parents 6e4a2e7 + cddf395 commit 3cc7834
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions macros/activity_schema/activity/build_json.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
{%- macro redshift__build_json(data_types) -%}
{%- if data_types is not none -%}
{%- set features = data_types.keys() -%}
'{' ||
json_parse('{' ||
{% for feature in features -%}
{% if not loop.first -%}', '|| {%- endif -%}'"{{feature}}": "' || decode(cast({{feature}} as {{dbt.type_string()}}), null, '', cast({{feature}} as {{dbt.type_string()}})){% if not loop.last %} ||'"'{% endif %}
{% endfor -%}
|| '"}'
|| '"}')
{%- else -%}
cast(null as varchar)
cast(null as super)
{%- endif -%}
{%- endmacro -%}

Expand Down

0 comments on commit 3cc7834

Please sign in to comment.