Skip to content

Commit

Permalink
Merge pull request dbt-labs#66 from fishtown-analytics/feature/curren…
Browse files Browse the repository at this point in the history
…t-timestamp-in-utc

Feature/current timestamp in utc
  • Loading branch information
jthandy authored May 23, 2018
2 parents 6117edf + 1832a25 commit 2d46852
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version: '0.1.0'
target-path: "target"
clean-targets: ["target", "dbt_modules"]
macro-paths: ["macros"]
log-path: "logs"
log-path: "logs"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

-- how can we test this better?
select
{{ dbt_utils.current_timestamp_in_utc() }} as actual,
{{ dbt_utils.current_timestamp_in_utc() }} as expected
24 changes: 19 additions & 5 deletions macros/cross_db_utils/current_timestamp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
{% endmacro %}

{% macro default__current_timestamp() %}
current_timestamp()
current_timestamp::{{dbt_utils.type_timestamp()}}
{% endmacro %}

{% macro redshift__current_timestamp() %}
current_timestamp::timestamp
{% macro bigquery__current_timestamp() %}
current_timestamp
{% endmacro %}

{% macro postgres__current_timestamp() %}
current_timestamp::timestamp


{% macro current_timestamp_in_utc() %}
{{ adapter_macro('dbt_utils.current_timestamp_in_utc') }}
{% endmacro %}

{% macro default__current_timestamp_in_utc() %}
{{dbt_utils.current_timestamp()}}
{% endmacro %}

{% macro snowflake__current_timestamp_in_utc() %}
convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}
{% endmacro %}

{% macro postgres__current_timestamp_in_utc() %}
(current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}
{% endmacro %}

0 comments on commit 2d46852

Please sign in to comment.