Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Berlaku untuk:
Databricks SQL
Databricks Runtime
Memulihkan tabel Delta ke status sebelumnya. Dukungan tersedia untuk memulihkan ke nomor versi yang lebih lama atau cap waktu.
Halaman ini berisi detail untuk menggunakan sintaks yang benar dengan RESTORE perintah . Lihat Bekerja dengan riwayat tabel untuk panduan selengkapnya tentang menavigasi versi tabel Delta Lake dengan perintah ini.
Sintaks
RESTORE [ TABLE ] table_name [ TO ] time_travel_version
time_travel_version
{ TIMESTAMP AS OF timestamp_expression |
VERSION AS OF version }
Parameter-parameternya
-
Mengidentifikasi tabel Delta yang akan dipulihkan. Nama tabel tidak boleh menggunakan spesifikasi temporal atau spesifikasi opsi.
-
timestamp_expressiondapat berupa salah satu dari:-
'2018-10-18T22:15:12.013Z', yaitu, string yang dapat diubah ke stempel waktu cast('2018-10-18 13:36:32 CEST' as timestamp)-
'2018-10-18', yaitu, string tanggal current_timestamp() - interval 12 hoursdate_sub(current_date(), 1)- Ekspresi lain yang dapat diubah atau dikonversi menjadi timestamp
-
-
versionadalah nilai panjang yang dapat diperoleh dari outputDESCRIBE HISTORY table_spec.
Baik timestamp_expression maupun version tidak boleh berupa subkueri.
Contoh
-- Restore the employee table to a specific timestamp
> RESTORE TABLE employee TO TIMESTAMP AS OF '2022-08-02 00:00:00';
table_size_after_restore num_of_files_after_restore num_removed_files num_restored_files removed_files_size restored_files_size
100 3 1 0 574 0
-- Restore the employee table to a specific version number retrieved from DESCRIBE HISTORY employee
> RESTORE TABLE employee TO VERSION AS OF 1;
table_size_after_restore num_of_files_after_restore num_removed_files num_restored_files removed_files_size restored_files_size
100 3 1 0 574 0
-- Restore the employee table to the state it was in an hour ago
> RESTORE TABLE employee TO TIMESTAMP AS OF current_timestamp() - INTERVAL '1' HOUR;
table_size_after_restore num_of_files_after_restore num_removed_files num_restored_files removed_files_size restored_files_size
100 3 1 0 574 0