Skip to content

Commit

Permalink
Merge pull request #280 from ScalefreeCOM/fix/databricks-replace-unsu…
Browse files Browse the repository at this point in the history
…pported-timestamp_sub-function

FIX:databricks/postgres/redshift: replace unsupported timestamp_sub- and dateadd-functions in pit macros
  • Loading branch information
tkiehn authored Nov 7, 2024
2 parents 9ecd6d0 + 9a497ef commit 685cdb4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion macros/tables/databricks/pit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pit_records AS (
SELECT
{{ hashkey }},
{{ ldts }},
COALESCE(LEAD(TIMESTAMP_SUB({{ ldts }}, INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
COALESCE(LEAD(({{ldts}} - INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
FROM {{ ref(satellite) }}
) {{ satellite }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion macros/tables/postgres/pit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pit_records AS (
SELECT
{{ hashkey }},
{{ ldts }},
COALESCE(LEAD(TIMESTAMP_SUB({{ ldts }}, INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
COALESCE(LEAD({{ ldts }} - INTERVAL '1 MICROSECOND') OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
FROM {{ ref(satellite) }}
) {{ satellite }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion macros/tables/redshift/pit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pit_records AS (
SELECT
{{ hashkey }},
{{ ldts }},
COALESCE(LEAD(DATEADD(microsecond,-1, {{ ldts }})) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
COALESCE(LEAD({{ ldts }} - interval '00:00:00.000001') OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
FROM {{ ref(satellite) }}
) {{ satellite }}
{% endif %}
Expand Down

0 comments on commit 685cdb4

Please sign in to comment.