dbt_valid_to_current
Available in 1.9 or with Versionless dbt Cloud.
snapshots:
my_project:
+dbt_valid_to_current: "to_date('9999-12-31')"
{{
config(
unique_key='id',
strategy='timestamp',
updated_at='updated_at',
dbt_valid_to_current='to_date('9999-12-31')'
)
}}
snapshots:
<resource-path>:
+dbt_valid_to_current: "to_date('9999-12-31')"
Description
Use the dbt_valid_to_current
config to set a custom future date for dbt_valid_to
in new snapshot columns. When set, dbt will use this specified value instead of NULL
for dbt_valid_to
in the snapshot table.
This simplifies makes it easier to assign date, work in a join, and range-based filtering with an end date.
Default
By default, dbt_valid_to
is set to NULL
for current (most recent) records in your snapshot table. This means that these records are still valid and have no defined end date.
If you prefer to use a specific value instead of NULL
for dbt_valid_to
in current and future records, you can use the dbt_valid_to_current
configuration option. For example, setting a date in the far future, 9999-12-31
.
The value assigned to dbt_valid_to_current
should be a string representing a valid date or timestamp, depending on your database's requirements. Use expressions that work within the data platform.