List available versions and their timestamps with DESCRIBE HISTORY delta.`/path/to/table` to identify the target version number or timestamp.
Query by version in Spark SQL: SELECT * FROM delta.`/path/to/table` VERSION AS OF 42.
Query by timestamp: SELECT * FROM delta.`/path/to/table` TIMESTAMP AS OF '2024-03-15T00:00:00'.
In the DataFrame API use: spark.read.format('delta').option('versionAsOf', 42).load('/path/to/table') or option('timestampAsOf', '2024-03-15').
Compare row counts or aggregate values between the historical and current versions to validate data evolution or audit changes.
Known gotchas
Time-travel queries only work within the transaction log retention window; once log entries and data files are vacuumed, historical versions are inaccessible.
The timestampAsOf option resolves to the latest version committed at or before the given timestamp; if no version exists before that timestamp the query errors.
On partitioned tables, time-travel does not revert partition metadata to historical state automatically; queries may still see current partition statistics even when reading old data.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp