Databricks Machine Learning Professional Question 13
Select 2You are working on a machine learning project using a Delta table to store training data. A recent update to the Delta table introduced an error in the data. You want to view the table's history to identify the correct version and then load the previous version of the table for your analysis. Which of the following steps should you take?
- A
Use the
DESCRIBE HISTORYcommand to inspect the table's version history. - B
Use the
RESTOREcommand to revert the Delta table to a previous version. - C
Use the
VERSION AS OFoption in your query to load the desired previous version of the Delta table. - D
Manually modify the Delta table's
_delta_logfiles to roll back to a previous version. - E
View the Delta table's history with the
SHOW VERSIONScommand.
Show answer and explanation
Correct answers: A, C
Explanation
To address the issue, you should first use the DESCRIBE HISTORY command to inspect the Delta table's version history and identify the correct version. Once the desired version is identified, you can use the VERSION AS OF option in your query to load that specific version of the Delta table. This approach allows you to analyze the previous data without modifying the Delta table itself.
- A. Correct.
The
DESCRIBE HISTORYcommand is the correct way to inspect the table's version history in Delta Lake. It provides details about previous versions, including operation type, user, and timestamp. - B. Incorrect.
The
RESTOREcommand is used to revert a Delta table to a previous state, but it permanently alters the table. This is not the correct step for simply loading a previous version of the table. - C. Correct.
The
VERSION AS OFoption is the correct way to query and load a specific version of the Delta table without modifying the table itself. - D. Incorrect.
Manually modifying the
_delta_logfiles is not a supported or recommended approach for managing Delta table versions. This could lead to corruption and is not a valid solution. - E. Incorrect.
The
SHOW VERSIONScommand is not a valid Delta Lake command. There is no such command in Delta Lake for viewing table history.