Delta Time Travel
Explore how Delta Lake Time Travel enables you to view and restore previous versions of Delta tables in Databricks. Understand using version history, querying data as of a specific version or timestamp, and restoring table states to correct errors or recover data. This lesson guides you in managing reliable, versioned data workflows with Delta Lake's time travel capabilities.
Delta Lake records every change made to a Delta table as a numbered version. Every time you write to a Delta table, whether you insert rows, update values, or delete records, Delta saves the previous state and assigns a new version number starting from 0.
Time Travel lets you read the table as it looked at any past version, without changing the current state. You can also fully restore the table to a previous version when you need to undo a mistake. The key distinction to keep in mind throughout this lesson: reading a past version is non-destructive (the table is unchanged); restoring permanently changes what the table looks like for all future queries.
In Databricks Community Edition, time travel works for managed Delta tables, and you don’t need to worry about file storage paths.
Why time travel is useful
Imagine this scenario:
Your
salestable has 100 rows, including a row for Alice with a sales value of150.Someone accidentally runs an
UPDATEthat sets Alice's sales to0.Without Delta, that original value would be gone permanently. ...