Databricks Data Engineer Professional Question 144
Single answerYou are managing a Delta Lake table in Databricks called 'sales_data'. You need to create a clone of the table for testing purposes. The clone should include the full history and data of the source table. After creating the clone, you notice that some changes made to the source table after cloning are not reflected in the target table. Which cloning approach should you use to ensure the cloned table includes the full history and remains independent of the source table?
- A
Use a shallow clone of the 'sales_data' table.
- B
Use a deep clone of the 'sales_data' table.
- C
Create a new Delta table using a SELECT * FROM 'sales_data' statement.
- D
Use a shallow clone and enable automatic sync of the source and target tables.
Show answer and explanation
Correct answer: B
Explanation
To create an independent clone of a Delta Lake table that includes the full history and data, you need to use a deep clone. A shallow clone only copies metadata and references the source table's data files, while a SELECT * statement would only capture the data's current state without history. Deep clones ensure the clone is decoupled from the source and includes all historical data.
- A. Incorrect.
A shallow clone only replicates metadata and references the existing data files in the source table. It does not copy the full history or data and remains linked to the source table, meaning changes to the source table are not reflected in the clone.
- B. Correct.
A deep clone creates a full, independent copy of the source table, including all data and history. Changes made to the source table after cloning do not affect the deep clone. This is the correct approach for the described scenario.
- C. Incorrect.
Creating a new Delta table using a SELECT * statement only copies the current state of the data, not the history. Additionally, it does not provide a direct clone and does not fulfill the requirement of including the full history.
- D. Incorrect.
Shallow clones do not support automatic synchronization between the source and target tables. This option is not valid as it misunderstands the functionality of shallow clones.