ROLLBACK TABLE
Roll back an Iceberg table to a previous snapshot using either a timestamp or a snapshot ID. For more information about rolling back tables, see Rolling Back Tables. Users who have been assigned the ADMIN
role, the table's owner, and users with INSERT
, UPDATE
, or DELETE
privileges on the table can use the ROLLBACK
command.
ROLLBACK TABLE <table_name>
TO { [ SNAPSHOT '<snapshot_id>' ] | [ TIMESTAMP '<timestamp>' ] }
Parameters
<table_name> String
The path of the Iceberg table that you want to roll back.
TO { [ SNAPSHOT '<snapshot_id>' ] | [ TIMESTAMP '<timestamp>' ] } String
Specifies whether you are rolling back to a specific snapshot or to a certain point in time:
TO SNAPSHOT '<snapshot_id>'
: The ID of the snapshot that you want to roll back to. Must be contained in single quotes.TO TIMESTAMP '<timestamp>'
: The timestamp that specifies the time that you want to roll back to. If the timestamp matches a snapshot's timestamp exactly, the Iceberg table is rolled back to that snapshot. Otherwise, the table is rolled back to the last snapshot before the time specified by the timestamp. Must be in UTC format and contained in single quotes (for example,'2022-11-01 01:00:00'
).
Examples
Roll back the table to the specified snapshot IDROLLBACK TABLE demo.example_table TO SNAPSHOT '2489484212521283189'
ROLLBACK TABLE demo.example_table TO TIMESTAMP '2022-06-22 17:06:00'