Databricks Data Engineer Associate Question 281
Single answerYou are working on a Delta Lake table in Databricks and accidentally introduced incorrect data via an update operation. You realize the mistake and want to roll back the table to a previous version from before the update. What is the correct way to achieve this?
- A
Use the RESTORE TABLE command to specify the desired version.
- B
Use the DESCRIBE HISTORY command to identify the version and then perform a DELETE operation on the current table.
- C
Use the RESTORE TABLE command with a timestamp or version number to revert the table.
- D
Overwrite the table with the data from the desired version by reading the specific version using the Delta table's time travel functionality.
Show answer and explanation
Correct answer: C
Explanation
Delta Lake provides the RESTORE TABLE command to revert a table to a specific version or timestamp. This is the most efficient and correct way to roll back a table to a previous version, ensuring that the table's state is restored without manual interventions.
- A. Incorrect.
The RESTORE TABLE command does not exist in Databricks Delta Lake. This option is incorrect.
- B. Incorrect.
DESCRIBE HISTORY helps identify the history of changes and versions, but it cannot directly be used to revert or roll back a table. DELETE is not a valid approach for rolling back.
- C. Correct.
This is correct because Delta Lake supports rolling back a table to a previous version using the RESTORE TABLE command with a specific version number or timestamp.
- D. Incorrect.
While time travel functionality can be used to query old versions of the table, it cannot directly overwrite the table to restore it. Additional manual steps would be required, making this option incorrect.