Skip to content

Commit 6c822cb

Browse files
authored
Add the datatypes Array and Variant to Snowflake ghost records
1 parent d083d23 commit 6c822cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

macros/supporting/ghost_record_per_datatype.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,15 @@
192192
{%- endif -%}
193193
{%- elif datatype in ['NUMBER','INT','FLOAT','DECIMAL'] %}{{unknown_value__numeric}} AS {{ alias }}
194194
{%- elif datatype == 'BOOLEAN' %}CAST('FALSE' AS BOOLEAN) AS {{ alias }}
195+
{%- elif datatype in ['ARRAY', 'VARIANT'] %} CAST('{{ unknown_value__STRING }}' as {{ datatype }} ) AS {{ alias }}
195196
{%- else %}NULL AS {{ alias }}
196197
{% endif %}
197198
{%- elif ghost_record_type == 'error' -%}
198199
{%- if datatype in ['TIMESTAMP_NTZ','TIMESTAMP'] %}{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }} AS {{ alias }}
199200
{%- elif datatype == 'DATE'-%} TO_DATE('{{ end_of_all_times_date }}', '{{ date_format }}' ) as {{ alias }}
200201
{%- elif datatype in ['STRING','VARCHAR','TEXT'] %}'{{ error_value__STRING }}' AS {{ alias }}
201202
{%- elif datatype == 'CHAR' %}CAST('{{ error_value_alt__STRING }}' as {{ datatype }} ) as {{ alias }}
202-
{%- elif datatype.upper().startswith('VARCHAR(') or datatype.upper().startswith('CHAR(') -%}
203+
{%- elif datatype.upper().startswith('VARCHAR(') or datatype.upper().startswith('CHAR(') -%}
203204
{%- if col_size is not none -%}
204205
{%- set error_dtype_length = col_size | int -%}
205206
{%- if '(' not in datatype -%}
@@ -217,8 +218,9 @@
217218
{%- endif -%}
218219
{% elif datatype in ['NUMBER','INT','FLOAT','DECIMAL'] %}{{error_value__numeric}} AS {{ alias }}
219220
{% elif datatype == 'BOOLEAN' %}CAST('FALSE' AS BOOLEAN) AS {{ alias }}
221+
{%- elif datatype in ['ARRAY', 'VARIANT'] %} CAST('{{ error_value__STRING }}' as {{ datatype }} ) AS {{ alias }}
220222
{% else %}NULL AS {{ alias }}
221-
{% endif %}
223+
{% endif %}
222224
{%- else -%}
223225
{%- if execute -%}
224226
{{ exceptions.raise_compiler_error("Invalid Ghost Record Type. Accepted are 'unknown' and 'error'.") }}

0 commit comments

Comments
 (0)