deltalake_core::operations

Module restore

Source
Expand description

Perform restore of delta table to a specified version or datetime

Algorithm:

  1. Read the latest state snapshot of the table.
  2. Read table state for version or datetime to restore
  3. Compute files available in state for restoring (files were removed by some commit) but missed in the latest. Add these files into commit as AddFile action.
  4. Compute files available in the latest state snapshot (files were added after version to restore) but missed in the state to restore. Add these files into commit as RemoveFile action.
  5. If ignore_missing_files option is false (default value) check availability of AddFile in file system.
  6. Commit Protocol, all RemoveFile and AddFile actions into delta log using LogStore::write_commit_entry (commit will be failed in case of parallel transaction) TODO: comment is outdated
  7. If table was modified in parallel then ignore restore and raise exception.

§Example

let table = open_table("../path/to/table")?;
let (table, metrics) = RestoreBuilder::new(table.object_store(), table.state).with_version_to_restore(1).await?;

Structs§

  • Restore a Delta table with given version See this module’s documentation for more information
  • Metrics from Restore