Hi everyone, a question on snapshots:
In my process I need to subtract a millisecond from the subsequent record’s “valid_from” timestamp and this value should be updated as “valid_to timestamp” of the current record ( rather than simply updating to the “valid_from” of the next row as is…)
How can I configure this manipulation within the snapshot mechanism?
Thanks in advance for all the help!
Two options:
- you could build a view on top of your snapshot which applies the transformations you need. This is best in alignment with our recommendation of treating snapshots as sources.
- you could build a custom implementation of the snapshot macro which applies the time offset. This would be more complex, and I haven’t done it myself so don’t have any specific guidance beyond pointing you to the macros where it’s implemented: dbt-core/core/dbt/include/global_project/macros/materializations/snapshots at main · dbt-labs/dbt-core · GitHub
Thank you so much for the response @joellabes !
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.