-
lance.LanceDataset.cleanup_old_versions(older_than: timedelta | None =
None
, *, delete_unverified: bool =False
, error_if_tagged_old_versions: bool =True
) CleanupStats Cleans up old versions of the dataset.
Some dataset changes, such as overwriting, leave behind data that is not referenced by the latest dataset version. The old data is left in place to allow the dataset to be restored back to an older version.
This method will remove older versions and any data files they reference. Once this cleanup task has run you will not be able to checkout or restore these older versions.
- Parameters:
- older_than : timedelta, optional¶
Only versions older than this will be removed. If not specified, this will default to two weeks.
- delete_unverified : bool, default False¶
Files leftover from a failed transaction may appear to be part of an in-progress operation (e.g. appending new data) and these files will not be deleted unless they are at least 7 days old. If delete_unverified is True then these files will be deleted regardless of their age.
This should only be set to True if you can guarantee that no other process is currently working on this dataset. Otherwise the dataset could be put into a corrupted state.
- error_if_tagged_old_versions : bool, default True¶
Some versions may have tags associated with them. Tagged versions will not be cleaned up, regardless of how old they are. If this argument is set to True (the default), an exception will be raised if any tagged versions match the parameters. Otherwise, tagged versions will be ignored without any error and only untagged versions will be cleaned up.