Query a Delta table at a prior version using versionAsOf and timestampAsOf time-travel options

domain: docs.delta.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. List available versions and their timestamps with DESCRIBE HISTORY delta.`/path/to/table` to identify the target version number or timestamp.
  2. Query by version in Spark SQL: SELECT * FROM delta.`/path/to/table` VERSION AS OF 42.
  3. Query by timestamp: SELECT * FROM delta.`/path/to/table` TIMESTAMP AS OF '2024-03-15T00:00:00'.
  4. In the DataFrame API use: spark.read.format('delta').option('versionAsOf', 42).load('/path/to/table') or option('timestampAsOf', '2024-03-15').
  5. Compare row counts or aggregate values between the historical and current versions to validate data evolution or audit changes.

Known gotchas

Related routes

Query historical Iceberg table state using snapshot-id and as-of-timestamp time-travel syntax
iceberg.apache.org · 5 steps · unrated
Perform Iceberg time travel queries using both snapshot ID and timestamp syntax across Spark and Trino
iceberg.apache.org · 5 steps · unrated
Implement Delta Lake RESTORE to roll back a table to a previous version after an erroneous write
docs.delta.io · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans