Skip to content

Commit

Permalink
refactor: update to_date and to_double
Browse files Browse the repository at this point in the history
for to_date and to_double first cast to varchar
  • Loading branch information
m-veens authored and cverhoef committed Feb 8, 2022
1 parent 4e8f4b3 commit a410745
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion macros/multiple_databases/to_date.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro to_date(attribute) %}

{% if target.type == 'snowflake' %}
try_to_date({{ attribute }}, '{{ var("date_format") }}')
try_to_date(to_varchar({{ attribute }}), '{{ var("date_format") }}')
{% elif target.type == 'sqlserver' %}
try_convert(date, {{ attribute }}, {{ var("date_format") }})
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion macros/multiple_databases/to_double.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro to_double(attribute) %}

{% if target.type == 'snowflake' %}
try_to_double({{ attribute }})
try_to_double(to_varchar({{ attribute }}))
{% elif target.type == 'sqlserver' %}
try_convert(float, {{ attribute }})
{% endif %}
Expand Down

0 comments on commit a410745

Please sign in to comment.