1
votes

I am trying to restore a delta table to its previous version via spark java , am using local ide .code is as below

import io.delta.tables.*; 
DeltaTable deltaTable = DeltaTable.forPath(spark, <path-to-table>); 
DeltaTable deltaTable = DeltaTable.forName(spark, <table-name>); 
deltaTable.restoreToVersion(0) // restore table to     oldest version
deltaTable.restoreToTimestamp("2019-02-14") // restore to a specific timestamp

As per the documentation databricks doc the method given here is not available in delta-core version 0.8.0. The method is also not in the api docs .

Is this only available in Datbricks run time?

Currently i have to load with the previous version and rewrite the df using delta.Is there any better way to do it?

1

1 Answers

1
votes

As you correctly guessed, those methods restoreToVersion and restoreToTimestamp are specific to databricks and not present in open-source deltalake version. There is no trace of such methods in open-source deltalake as you can check in delta-lake repository

So currently and as far as I know, there is no other method than rewriting from a previous version, as explained in answers of this question