-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove references to deprecated dbt-utils cross-db macros (#79)
* Remove references to deprecated dbt-utils cross-db macros * Implement current_timestamp()
- Loading branch information
1 parent
20308b3
commit 424b2fe
Showing
23 changed files
with
101 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{%- macro n_days_ago(n, date=None, tz=None) -%} | ||
{%-set dt = date if date else dbt_date.today(tz) -%} | ||
{%- set n = n|int -%} | ||
cast({{ dbt_utils.dateadd('day', -1 * n, dt) }} as date) | ||
cast({{ dateadd('day', -1 * n, dt) }} as date) | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{%- macro n_months_ago(n, tz=None) -%} | ||
{%- set n = n|int -%} | ||
{{ dbt_utils.date_trunc('month', | ||
dbt_utils.dateadd('month', -1 * n, | ||
{{ date_trunc('month', | ||
dateadd('month', -1 * n, | ||
dbt_date.today(tz) | ||
) | ||
) }} | ||
{%- endmacro -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{%- macro n_months_away(n, tz=None) -%} | ||
{%- set n = n|int -%} | ||
{{ dbt_utils.date_trunc('month', | ||
dbt_utils.dateadd('month', n, | ||
{{ date_trunc('month', | ||
dateadd('month', n, | ||
dbt_date.today(tz) | ||
) | ||
) }} | ||
{%- endmacro -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{%- macro n_weeks_ago(n, tz=None) -%} | ||
{%- set n = n|int -%} | ||
{{ dbt_utils.date_trunc('week', | ||
dbt_utils.dateadd('week', -1 * n, | ||
{{ date_trunc('week', | ||
dateadd('week', -1 * n, | ||
dbt_date.today(tz) | ||
) | ||
) }} | ||
{%- endmacro -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{%- macro n_weeks_away(n, tz=None) -%} | ||
{%- set n = n|int -%} | ||
{{ dbt_utils.date_trunc('week', | ||
dbt_utils.dateadd('week', n, | ||
{{ date_trunc('week', | ||
dateadd('week', n, | ||
dbt_date.today(tz) | ||
) | ||
) }} | ||
{%- endmacro -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
{%- macro now(tz=None) -%} | ||
{{ dbt_date.convert_timezone(dbt_utils.current_timestamp(), tz) }} | ||
{%- endmacro -%} | ||
{{ dbt_date.convert_timezone(dbt_date.current_timestamp(), tz) }} | ||
{%- endmacro -%} | ||
|
||
{% macro current_timestamp() -%} | ||
{{ return(adapter.dispatch('current_timestamp', 'dbt_date')()) }} | ||
{%- endmacro %} | ||
|
||
{% macro default__current_timestamp() %} | ||
current_timestamp::{{ type_timestamp() }} | ||
{% endmacro %} | ||
|
||
{% macro redshift__current_timestamp() %} | ||
getdate() | ||
{% endmacro %} | ||
|
||
{% macro bigquery__current_timestamp() %} | ||
current_timestamp | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{%- macro periods_since(date_col, period_name='day', tz=None) -%} | ||
{{ dbt_utils.datediff(date_col, dbt_date.now(tz), period_name) }} | ||
{{ datediff(date_col, dbt_date.now(tz), period_name) }} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.