Skip to content

Commit

Permalink
Check both dbt_valid_to_current and null
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Sep 27, 2024
1 parent 1ef4fbc commit a5a25ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbt/include/spark/macros/materializations/snapshot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
on DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }} = DBT_INTERNAL_DEST.{{ columns.dbt_scd_id }}
when matched
{% if config.get("dbt_valid_to_current") %}
and DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }}
and ( DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }} or
DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null )
{% else %}
and DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null
{% endif %}
Expand Down

0 comments on commit a5a25ab

Please sign in to comment.