Skip to main content
Version: Next

HOOK CLEANUP PITS


This macro should be used as a post hook for each PIT table, whenever a logarithmic snapshot logic is used. The macro deletes all records in a PIT table, that are no longer active. Deletion is no problem here because no actual data is deleted, only pointers to satellite entries.

ParametersData TypeRequiredDefault ValueExplanation
snapshot_relationstringmandatoryThe name of the dbt model that creates the snapshot table / view, that has the logarithmic snapshot logic applied.
snapshot_trigger_columnstringoptionaldatavault4dbt.snapshot_trigger_columnThe name of the boolean column inside the snapshot tables, that activate/deactivate single snapshots.
sdtsstringoptionaldatavault4dbt.sdts_aliasThe name of the snapshot date timestamp column inside the snapshot table.

Example Usage:

An example usage for applying this macro as a post hook for a PIT table would look like this inside the PIT source_models config block:

{{ config(post_hook="{{ datavault4dbt.clean_up_pit('control_snap_view') }}") }}