-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* patch/update-macro-readme * bug/postgres-performance * remove int model * remove int model * switch to jsonb * add limit for test * update changelog and regen docs * Update README.md fixed links * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Alex Ilyichov <alexander.ilyichov@fivetran.com>
- Loading branch information
1 parent
d355614
commit 8b325b8
Showing
13 changed files
with
61 additions
and
48 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,35 +1,18 @@ | ||
{% macro fivetran_log_lookback(from_date, datepart='day', interval=7, default_start_date='2010-01-01') %} | ||
{% macro fivetran_log_lookback(from_date, datepart='day', interval=7, safety_date='2010-01-01') %} | ||
|
||
{{ adapter.dispatch('fivetran_log_lookback', 'fivetran_log') (from_date, datepart='day', interval=7, default_start_date='2010-01-01') }} | ||
{{ adapter.dispatch('fivetran_log_lookback', 'fivetran_log') (from_date, datepart='day', interval=7, safety_date='2010-01-01') }} | ||
|
||
{%- endmacro %} | ||
|
||
{% macro default__fivetran_log_lookback(from_date, datepart='day', interval=7, default_start_date='2010-01-01') %} | ||
{% macro default__fivetran_log_lookback(from_date, datepart='day', interval=7, safety_date='2010-01-01') %} | ||
|
||
coalesce( | ||
(select {{ dbt.dateadd(datepart=datepart, interval=-interval, from_date_or_timestamp=from_date) }} | ||
from {{ this }}), | ||
{{ "'" ~ default_start_date ~ "'" }} | ||
) | ||
{% set sql_statement %} | ||
select coalesce({{ from_date }}, {{ "'" ~ safety_date ~ "'" }}) | ||
from {{ this }} | ||
{%- endset -%} | ||
|
||
{% endmacro %} | ||
{%- set result = dbt_utils.get_single_value(sql_statement) %} | ||
|
||
{% macro bigquery__fivetran_log_lookback(from_date, datepart='day', interval=7, default_start_date='2010-01-01') %} | ||
|
||
-- Capture the latest timestamp in a call statement instead of a subquery for optimizing BQ costs on incremental runs | ||
{%- call statement('date_agg', fetch_result=True) -%} | ||
select {{ from_date }} from {{ this }} | ||
{%- endcall -%} | ||
|
||
-- load the result from the above query into a new variable | ||
{%- set query_result = load_result('date_agg') -%} | ||
|
||
-- the query_result is stored as a dataframe. Therefore, we want to now store it as a singular value. | ||
{%- set date_agg = query_result['data'][0][0] %} | ||
|
||
coalesce( | ||
{{ dbt.dateadd(datepart='day', interval=-7, from_date_or_timestamp="'" ~ date_agg ~ "'") }}, | ||
{{ "'" ~ default_start_date ~ "'" }} | ||
) | ||
{{ dbt.dateadd(datepart=datepart, interval=-interval, from_date_or_timestamp="cast('" ~ result ~ "' 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
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 |
---|---|---|
|
@@ -34,4 +34,4 @@ final as ( | |
) | ||
|
||
select * | ||
from final | ||
from final |