dr_expire_snapshots()
This is catalog-wide maintenance, including tables outside DataRaft. It does
not delete release tables, reports, lineage or landing files. DataRaft release
pins refer to live immutable tables, not DuckLake snapshot IDs. External
time-travel consumers must retain their own required snapshot horizon.
Usage
dr_expire_snapshots(
lake,
older_than_days = 30,
file_retention_days = 7,
dry_run = TRUE,
readers_quiescent = FALSE
)Arguments
- lake
- Connected DuckLake lake.
- older_than_days
- Positive snapshot retention in days.
- file_retention_days
- Positive grace period after file deletion scheduling.
- dry_run
- Preview both operations without writes. Defaults to
TRUE. - readers_quiescent
- Whether an exclusive maintenance window is in effect.
Value
A list containing DuckLake snapshot and file operation results.
Details
Execution requires an exclusive maintenance window with no other readers or
writers, including direct DuckDB clients.
readers_quiescent is the caller's
assertion of that condition; it is not detected across remote sessions.
Snapshots are expired first. File cleanup removes only files already scheduled
for deletion before the separate retention cutoff, never freshly expired files
or untracked orphan files. Physical file deletion is not transactional.
Examples
if (FALSE) {
dr_expire_snapshots(lake)
dr_expire_snapshots(lake, dry_run = FALSE, readers_quiescent = TRUE)
}See also
Documentation source snapshot · View source at 113c179 ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.