[CT-3252] [Feature] Add a way to refresh Snapshots in the database #8885
Description
Is this your first time submitting a feature request?
- I have read the expectations for open source contributors
- I have searched the existing issues, and I could not find an existing issue for this feature
- I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
Describe the feature
Introduce a --full-refresh
option specifically for snapshot models, it can be analogous to the existing --full-refresh
feature for incremental models. This would enable the rebuilding of snapshots from scratch by dropping the existing target table in the database and re-executing the snapshot query.
Use cases:
- There may be scenarios where one would want to change the snapshot strategy. A full-refresh would facilitate alignment with the new strategy without causing data inconsistencies.
- Adding or removing columns from the original snapshot query is another case where a full-refresh would be useful to ensure the new rows don't deviate significantly from the historical data
Just like with incremental models, using full refresh could mean that all historical data in the snapshot table would be permanently deleted. However, there are use cases where such a refresh is not only acceptable but necessary for maintaining data integrity.
Describe alternatives you've considered
The only way would be to drop the tables outside dbt, however, this is not very efficient if you want to refresh multiple snapshots, having to run a separate command to the database for each table. With this option one could do something like:
dbt snapshot --select my-folder --target my-target --full-refresh
and dbt would handle rebuilding all the snapshot tables.
Who will this benefit?
No response
Are you interested in contributing this feature?
Happy to contribute if I'm given some pointers to where to look at
Anything else?
No response