-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Snapshots with check option - allow custom date field to be used when setting dbt_date_from and dbt_date_to fields. #1844
Comments
Hello, first time contributor here, I've started to look into the issue. I feel like the only change should be here. I would get the I'm not sure what kind of tests needs to be added. Edit : I would be happy to open a PR to show where I'm at if it's ok with you |
@PJGaetan I think that's right! You could replace the line you've identified with:
As far as testing this change, we already have a number of integration tests related to 'check' strategy snapshots in
I think a test for this could be as simple as copying/adapting one of those. After ensuring that the source table being snapshotted contains a date/timestamp column (the existing ones may not), create a snapshot with both the 'check' strategy and |
Overview of Change
Essentially we would like to be able to supply the following config so that a snapshot with check strategy honours the updated_at field that we supply when setting the dbt_date_from/to fields.
We would like to use the snapshot feature to manage type 2 changes on our dimensions (products, customers etc).
We need to use check mode (not timestamp) so we can look for record attributes that change (as well as new/deleted records).
In our staging layer we have a dw_load_datetime column on every staged dimension that represents when the data was processed. This is the timestamp from Airflow and importantly it allows us to replay historic runs (e.g. reload data for the past 3 days).
Question - can we tell dbt to use this dw_load_datetime in the snapshot when setting the dbt_date_from and dbt_date_to fields?
Currently dbt uses the current time to do this. We can see you support this use case when in timestamp mode - but we weren’t sure why this couldn’t also apply in check mode?
The text was updated successfully, but these errors were encountered: