Time Travel

Time Travel is the Lakehouse's historical data access and recovery mechanism, allowing you to query the data state of a table at any historical point in time, or roll back a table to a previous version.

What You Can Do

CapabilityDescription
Query historical dataView the data state of a table at a specific point in time
Recover accidentally deleted dataRoll back a table to a version before the erroneous operation
Recover dropped tablesRestore a dropped table using UNDROP TABLE
Audit data changesView the historical version list of a table

Quick Example

-- Query data at a specific time yesterday SELECT * FROM orders TIMESTAMP AS OF '2024-01-15 10:00:00'; -- View the historical versions of a table DESC HISTORY orders; -- Roll back a table to a specified version RESTORE TABLE orders TO TIMESTAMP AS OF '2024-01-15 10:00:00'; -- Recover a dropped table UNDROP TABLE orders;

Data Retention Configuration

The historical data retention period for Time Travel is controlled by data_retention_days, with a default of 1 day and a maximum of 90 days. Historical versions beyond the retention period cannot be accessed.

-- Set the data retention days for a table ALTER TABLE orders SET data_retention_days = 7;