Databricks Machine Learning Professional Question 12
Select 3You are working on a machine learning project where your team has accidentally overwritten a Delta table containing training data. You need to load a previous version of the Delta table to recover the original data for training. Which of the following steps should you take to view the Delta table's history and load a specific version of the table?
- A
Use the
DESCRIBE HISTORYcommand to view the Delta table's history and identify the version to restore. - B
Use the
RESTORE TABLEcommand to specify the exact version of the Delta table to load. - C
Use the
VERSION AS OFoption in a query to reference the specific version of the Delta table. - D
Use the
DESCRIBE TABLEcommand to view the Delta table's schema and determine its version history. - E
Use the
TIMESTAMP AS OFoption in a query to load the Delta table from a specific timestamp.
Show answer and explanation
Correct answers: A, C, E
Explanation
To recover a previous version of a Delta table, you first use the DESCRIBE HISTORY command to view the table's history and identify the version or timestamp you want to restore. Then, you can either use the VERSION AS OF option to query the table at a specific version or the TIMESTAMP AS OF option to query the table as it was at a specific time. These steps allow you to recover and load the original data without overwriting or duplicating the Delta table.
- A. Correct.
Correct. The
DESCRIBE HISTORYcommand provides the history of the Delta table, allowing you to identify the version number or timestamp needed to restore the desired state. - B. Incorrect.
Incorrect. There is no
RESTORE TABLEcommand in Delta Lake. Instead, you can query the Delta table using version or timestamp options. - C. Correct.
Correct. The
VERSION AS OFoption enables you to query the Delta table at a specific version, effectively loading that version. - D. Incorrect.
Incorrect. The
DESCRIBE TABLEcommand only provides schema information and does not show the version history of the Delta table. - E. Correct.
Correct. The
TIMESTAMP AS OFoption allows you to query the Delta table as it existed at a specific timestamp, which is another way to load a previous version.