Databricks Data Engineer Professional Question 196
Single answerYou are tasked with implementing a customer dimension table in Delta Lake to support historical and current customer data. The table must retain the full history of changes to certain attributes (e.g., address) while overwriting other attributes (e.g., email) with the latest value. Which implementation approach should you use?
- A
Implement an SCD Type 0 table, ensuring no updates occur to any attributes.
- B
Implement an SCD Type 1 table, updating all attributes with the latest values.
- C
Implement an SCD Type 2 table, tracking historical changes for certain attributes while overwriting others.
- D
Implement a hybrid table with both SCD Type 1 and Type 2 behavior, manually managing attribute-specific logic.
Show answer and explanation
Correct answer: C
Explanation
SCD Type 2 is the best approach for this scenario, as it allows historical tracking of some attributes (e.g., address) while overwriting others (e.g., email). This aligns with the requirement to retain history for specific attributes while keeping others up to date.
- A. Incorrect.
An SCD Type 0 table does not allow updates, which fails to meet the requirement of overwriting some attributes and tracking history for others.
- B. Incorrect.
An SCD Type 1 table updates all attributes with the latest values, but it does not retain historical data, which is required for some attributes in this scenario.
- C. Correct.
An SCD Type 2 table allows you to track historical changes for certain attributes while overwriting others, meeting the requirements of the scenario.
- D. Incorrect.
A hybrid table with manual management could theoretically work, but it is not a standard implementation approach for this type of use case and may introduce unnecessary complexity.