You have a Delta Lake solution that contains a table named table1. You need to roll back the contents of table1 to 24 hours ago. Which command should you run?

Category : Microsoft Azure Data Engineering | Sub Category : Practice Assessment for Exam DP-203 - Data Engineering on Microsoft Azure | By Prasad Bonam Last updated: 2023-09-10 00:38:20 Viewed : 282


Ans: RESTORE TABLE employee TO TIMESTAMP AS OF current_timestamp() - INTERVAL 24 HOUR;

RESTORE TABLE employee TO TIMESTAMP AS OF current_timestamp() - INTERVAL 24 HOUR; restores the table to 24 hours ago.

VACUUM employee RETAIN 24; moves unused files from the delta folder.

COPY INTO employee1 copies data to a new table.

RESTORE - Azure Databricks - Databricks SQL | Microsoft Learn

Use Delta Lake in Azure Databricks - Training | Microsoft Learn


To roll back the contents of a Delta Lake table, such as "table1," to a specific point in time, you can use the RESTORE command with the AS OF clause. Here is the command you should run to roll back the contents of "table1" to 24 hours ago:

sql
RESTORE table1 TO TIMESTAMP (TIMESTAMP YYYY-MM-DD HH:MI:SS - INTERVAL 24 HOURS);

Replace YYY-MM-DD HH:MI:SS with the specific timestamp from 24 hours ago in the format YYYY-MM-DD HH:MI:SS.

This command will restore "table1" to its state as it existed 24 hours ago. Make sure you have the necessary permissions to execute this command, and that your Delta Lake setup supports the RESTORE operation.

Search
Related Articles

Leave a Comment: