init
This commit is contained in:
12
dbt/macros/convert_timezone.sql
Normal file
12
dbt/macros/convert_timezone.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
{% macro convert_timezone(value, format, timezone) %}
|
||||
{% if timezone | length %}
|
||||
{% set expression %}
|
||||
cast (FROM_TZ(to_timestamp('{{ value }}', '{{ format }}'), '{{ timezone }}') at time zone '{{ var("dbt_timezone") }}' as timestamp)
|
||||
{% endset %}
|
||||
{% else %}
|
||||
{% set expression %}
|
||||
to_timestamp('{{ value }}', '{{ format }}')
|
||||
{% endset %}
|
||||
{% endif %}
|
||||
{{ return(expression) }}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user