Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting dbt_valid_to snapshot column to new setting dbt_valid_to_current #152

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240927-133708.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Enable setting current value of dbt_valid_to
time: 2024-09-27T13:37:08.808843-04:00
custom:
Author: gshank
Issue: "151"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
from {{ source }} as DBT_INTERNAL_SOURCE
where DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }}::text = {{ target }}.{{ columns.dbt_scd_id }}::text
and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)
and {{ target }}.{{ columns.dbt_valid_to }} is null;
{% if config.get("dbt_valid_to_current") %}
and ({{ target }}.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }} or {{ target }}.{{ columns.dbt_valid_to }} is null);
{% else %}
and {{ target }}.{{ columns.dbt_valid_to }} is null;
{% endif %}


insert into {{ target }} ({{ insert_cols_csv }})
select {% for column in insert_cols -%}
Expand Down