Skip to content

Commit

Permalink
[fix] use cast macro in default__get_empty_schema_sql (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Apr 17, 2024
1 parent df1b8c3 commit 4774638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240411-185203.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix adapter-specific cast handling for constraint enforcement
time: 2024-04-11T18:52:03.960202-07:00
custom:
Author: michelleark
Issue: "166"
2 changes: 1 addition & 1 deletion dbt/include/global_project/macros/adapters/columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{%- do col_naked_numeric.append(col['name']) -%}
{%- endif -%}
{% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}
cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ ", " if not loop.last }}
{{ cast('null', col['data_type']) }} as {{ col_name }}{{ ", " if not loop.last }}
{%- endfor -%}
{%- if (col_err | length) > 0 -%}
{{ exceptions.column_type_missing(column_names=col_err) }}
Expand Down

0 comments on commit 4774638

Please sign in to comment.