Help Center/ Data Lake Insight/ Delta SQL Syntax Reference/ Delta Time Travel/ Restoring a Delta Table to an Earlier State
Updated on 2025-04-21 GMT+08:00

Restoring a Delta Table to an Earlier State

Syntax

Restore a Delta table to the state at a specific point in time:

RESTORE [TABLE] [database_name.]table_name|DELTA.`obs_path`

[TO] TIMESTAMP AS OF timestamp_expression

Restore a Delta table to the state at a specific historical version:

RESTORE [TABLE] [database_name.]table_name|DELTA.`obs_path`

[TO] VERSION AS OF version_code

Parameter Description

Table 1 Parameters for restoring a Delta table

Parameter

Description

database_name

Name of the database, consisting of letters, numbers, and underscores (_)

table_name

Name of the table in the database, consisting of letters, numbers, and underscores (_)

obs_path

OBS path, indicating the storage location of the Delta table

timestamp_expression

Timestamp, which cannot be later than the current time, formatted as yyyy-MM-ddTHH:mm:ss.SSS

version_code

Version number in the query result in Viewing History Operation Records of a Delta Table

Example

RESTORE delta_table0 TO TIMESTAMP AS OF '2020-10-18T22:15:12.013Z';
RESTORE delta.`obs://bucket_name/db0/delta_table0` VERSION AS OF 2;