QuestionQ131

VerifiedData Modelling

An upstream system emits change data capture (CDC) logs that are written to a cloud object-storage directory. Each log record identifies the change type (insert, update, or delete) and contains the values of every field after the change. The source table has a primary key in the pk_id field.

For audit purposes, the data governance team wants to retain a complete history of every value ever valid in the source system. For analytics, only the latest value for each record must be stored. The Databricks job that ingests these records runs once each hour, although an individual record can change multiple times during an hour.

Which solution satisfies these requirements?

Explanation

Applying every CDC event in sequence by pk_id preserves each intermediate version and correctly produces the current state after inserts, updates, and deletes. Retaining only one deduplicated or merged event per key would discard changes that occurred earlier in the hourly batch, so it cannot provide the required audit history. Databricks describes SCD Type 2 CDC processing as preserving complete history by creating a version for each change, with sequence ordering used to process events correctly.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!