Open gshank opened 1 month ago
Rough draft of YML:
{{
config(
target_database='analytics',
target_schema='snapshots',
unique_key='id',
strategy='timestamp',
updated_at='updated_at',
#ideas
coalesce_dbt_valid_to='date(9999, 12, 31)',
dbt_valid_to_for_current_records='date(9999, 12, 31)' #default is NULL
future_date_dbt_valid_to=false,
coalesce_dbt_valid_to=dbt_max_date(),
coalesce_dbt_valid_to=var('dbt_max_date')
)
}}
Description
Right now,
dbt_valid_to
is set toNULL
for current records.Some people, want to set
dbt_valid_to
to an arbitrary future date (so that their snapshot will work for a join, corporate standard, etc.).The way they do this today, is create a view on top of their snapshot:
Acceptance criteria
dbt_valid_to
for the current records in your snapshotNULL
(current behavior)"to_date('2024-05-10')"
'{{ var('my_future_date') }}'
'{{ dbt.date(9999, 12, 31) }}'
dbt_valid_to
is equal to for current records for the insertion logic when snapshotting, the existing snapshot must be updated before we can proceeddbt_is_current
column (as has been requested in another feature request) we could run a validation check to say "is every row withis_current = true
also havedbt_valid_to
equal to whatever I have set for mydbt_valid_to_for_current_records
config); could have a performance implicationstate:modified
we should throw a warning/error that this config has been updated (make them go in and manually update their existing snapshot)Notes
Ideas for how to handle config changes:
dbt_valid_to_for_current_records
,dbt_valid_to_current_records
,dbt_valid_to_default
,dbt_valid_to_current_indicator
,dbt_valid_to_current
,dbt_valid_to_current_date
,dbt_valid_to_current_marker