الاستعادة
ينطبق على: Databricks SQL
Databricks Runtime
استعادة جدول Delta إلى حالة سابقة. يتم دعم الاستعادة إلى رقم إصدار سابق أو طابع زمني.
تحتوي هذه الصفحة على تفاصيل لاستخدام بناء الجملة الصحيح مع RESTORE
الأمر . راجع العمل مع محفوظات جدول Delta Lake للحصول على مزيد من الإرشادات حول التنقل في إصدارات جدول Delta Lake باستخدام هذا الأمر.
بناء الجملة
RESTORE [ TABLE ] table_name [ TO ] time_travel_version
time_travel_version
{ TIMESTAMP AS OF timestamp_expression |
VERSION AS OF version }
المعلمات
-
تعريف جدول Delta المراد استعادته. يجب ألا يستخدم اسم الجدول مواصفات زمنية أو مواصفات خيارات.
timestamp_expression
يمكن أن يكون أي واحد من:'2018-10-18T22:15:12.013Z'
، أي سلسلة يمكن تحويلها إلى طابع زمنيcast('2018-10-18 13:36:32 CEST' as timestamp)
'2018-10-18'
، أي سلسلة تاريخcurrent_timestamp() - interval 12 hours
date_sub(current_date(), 1)
- أي تعبير آخر يتم تحويله أو يمكن تحويله إلى طابع زمني
version
هي قيمة طويلة يمكن الحصول عليها من إخراجDESCRIBE HISTORY table_spec
.
لا timestamp_expression
يمكن ولا version
الاستعلامات الفرعية.
الأمثلة
-- 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
المقالات ذات الصلة
- استعادة جدول Delta.