Databricks Data Engineer Associate Question 279
Single answerYou are working on a Delta Lake table in Databricks that has undergone multiple updates over time. One of your recent updates introduced a critical issue, and you need to revert the table to a previous version. How can you achieve this using Delta Lake functionality?
- A
Use the RESTORE TABLE command with the desired version number.
- B
Use the DELETE command to remove unwanted changes and manually reapply previous data.
- C
Use the DESCRIBE HISTORY command to identify the version and then use the RESTORE command to roll back to that version.
- D
Use SELECT statements with a WHERE clause on the _version column to filter data from the desired version.
Show answer and explanation
Correct answer: C
Explanation
Delta Lake provides the DESCRIBE HISTORY command to review a table's version history, which lists the operations performed on the table and their respective version numbers. To revert the table to a specific version, you can use the RESTORE command with the desired version obtained from the history. This ensures a reliable and efficient rollback process.
- A. Incorrect.
RESTORE TABLE is not a valid Delta Lake command. Delta Lake uses specific syntax to restore tables by referencing their version history.
- B. Incorrect.
Using the DELETE command and manually reapplying changes is error-prone and not recommended for managing Delta Lake versions. There are built-in commands for reverting to a previous state.
- C. Correct.
The DESCRIBE HISTORY command allows you to view the version history of a Delta table, and the RESTORE command can be used to revert the table to a specific version. This is the correct process for rolling back a table in Delta Lake.
- D. Incorrect.
There is no _version column in Delta Lake that allows filtering data. Delta Lake maintains versioning metadata, but it is not accessible through a standard SELECT query.