diff --git a/.changes/unreleased/Fixed-20240910-171459.yaml b/.changes/unreleased/Fixed-20240910-171459.yaml new file mode 100644 index 000000000..53f61ad48 --- /dev/null +++ b/.changes/unreleased/Fixed-20240910-171459.yaml @@ -0,0 +1,4 @@ +kind: Fixed +body: Fixed default arguments for copy stategy when they would appear empty when not + specified. +time: 2024-09-10T17:14:59.352269+01:00 diff --git a/.github/workflows/jaffle_shop/sources_external_tables_copy.yml b/.github/workflows/jaffle_shop/sources_external_tables_copy.yml index 97dbcd9b8..5c7bcb9c6 100644 --- a/.github/workflows/jaffle_shop/sources_external_tables_copy.yml +++ b/.github/workflows/jaffle_shop/sources_external_tables_copy.yml @@ -14,7 +14,6 @@ sources: object_pattern: '*raw_customers.csv' type: CSV auto_create: true - allow_column_mismatch: false max_errors_per_file: 10 csv_options: header: true diff --git a/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql b/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql index 2bae09264..a827f7c59 100644 --- a/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +++ b/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql @@ -68,8 +68,8 @@ ( {%- for column in columns -%} {{ column.name }} - {%- if column.default is not none %} DEFAULT {{ column.default }}{% endif %} - {%- if column.source_column_name is not none %} {{ '$' ~ loop.index0 }}{% endif %} + {%- if column.default %} DEFAULT {{ column.default }}{% endif %} + {%- if column.source_column_name %} {{ '$' ~ loop.index0 }}{% endif %} {{- ',' if not loop.last }} {%- endfor -%} ) @@ -83,10 +83,10 @@ {%- if options.type %} TYPE = {{ options.type }} {%- endif %} - {%- if options.auto_create is not none %} + {%- if options.auto_create %} AUTO_CREATE = {{ options.auto_create | upper }} {%- endif %} - {%- if options.allow_column_mismatch is not none %} + {%- if options.allow_column_mismatch %} ALLOW_COLUMN_MISMATCH = {{ options.allow_column_mismatch | upper }} {%- endif %} {%- if options.error_file %} @@ -99,7 +99,7 @@ MAX_ERRORS_PER_FILE = {{ options.max_errors_per_file }} {%- endif %} {%- if csv_options %} - {%- if csv_options.header is not none %} + {%- if csv_options.header %} HEADER = {{ csv_options.header | upper }} {%- endif %} {%- if csv_options.delimiter %} @@ -117,10 +117,10 @@ {%- if csv_options.null_string %} NULL_STRING = '{{ csv_options.null_string }}' {%- endif %} - {%- if csv_options.empty_field_as_null is not none %} + {%- if csv_options.empty_field_as_null %} EMPTY_FIELD_AS_NULL = {{ csv_options.empty_field_as_null | upper }} {%- endif %} - {%- if csv_options.skip_blank_lines is not none %} + {%- if csv_options.skip_blank_lines %} SKIP_BLANK_LINES = {{ csv_options.skip_blank_lines | upper }} {%- endif %} {%- if csv_options.date_format %}