Search code examples
databricksazure-databrickstimedeltadelta-lake

Databricks Delta Lake table history Error: AnalysisException: Cannot time travel Delta table to version 1. Available versions: [10, 22]


Can someone let me know why I can no longer version number one from Databricks History Version

When I execute the following code:

df = spark.read.format("delta").option("versionAsof", 1).load(saveloc)

I get the error:

AnalysisException: Cannot time travel Delta table to version 1. Available versions: [10, 22].

AS you can see the earliest version is 10. However, when I execute this same code a few days ago I was able to see version 1.

Any thoughts?


Solution

  • Most probably the old versions were recycled by applying the VACUUM command to your table - versions in the Delta table aren't kept indefinitely - there are retention settings so old versions & data files are removed. You can find more about it in the documentation.