Skip to content

Commit

Permalink
fix/redshift: replace dateadd() with inverval arithmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
tkiehn authored Nov 6, 2024
1 parent 57edccf commit 9a497ef
Showing 1 changed file with 1 addition and 1 deletion.
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 9a497ef

Please sign in to comment.