Updated on 2025-04-21 GMT+08:00

RESTORE

Function

This command restores a Delta table to an earlier state, supporting restoration to a previous version number or timestamp.

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

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 version 1.3.1

Required Permissions

  • SQL permissions
Table 2 Permissions required for executing RESTORE

Permission Description

UPDATE permission on a table

  • Fine-grained permission: dli:table:update
  • Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.

Example

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

System Response

You can view command execution results in the driver log or on the client.