Data Engineer Professional · Domain 1: Developing Code for Data Processing using Python and SQL · 23% of the exam
Task 1.7: Implement CDC pipelines using AUTO CDC APIs (formerly APPLY CHANGES) in Lakeflow Pipelines, including SCD Type 1 and Type 2 via stored_as_scd_type.
Keys, sequencing, deletes and truncates, out-of-order events, SCD type 1 and type 2 targets, history columns, and AUTO CDC FROM SNAPSHOT.
Study it
AUTO CDC: keys, sequencing, deletes, SCD type 1 and type 2
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.
Question 1 · choose 1
An AUTO CDC flow keeps a customers dimension as SCD type 2. Auditors need a new version row whenever a customer's address or segment changes. The source also updates last_login on every sign-in, and today each sign-in creates another history row, so the table grows quickly. last_login must still show its latest value. What should the data engineer change?
AAdd last_login to the COLUMNS * EXCEPT list of the flow
BChange the flow to STORED AS SCD TYPE 1
CAdd TRACK HISTORY ON * EXCEPT (last_login) to the flow
DAdd IGNORE NULL UPDATES to the flow
Show the answer and why
AAdd last_login to the COLUMNS * EXCEPT list of the flow
Incorrect
That drops the column from the target, so last_login would no longer show its latest value.
BChange the flow to STORED AS SCD TYPE 1
Incorrect
Type 1 keeps no history at all, which breaks the auditors' need for address and segment versions.
CAdd TRACK HISTORY ON * EXCEPT (last_login) to the flow
Correct
Columns left out of history tracking are updated in place on the current row, so only address and segment changes create new versions.
DAdd IGNORE NULL UPDATES to the flow
Incorrect
This does not limit which columns create history rows, so each sign-in still changes last_login and creates a version.
By default, SCD type 2 creates a version whenever any column changes. A TRACK HISTORY clause limits history to a set of columns; changes to the other columns overwrite the current version instead of adding a row.
A legacy system cannot produce a change feed. It exports a full snapshot of its customers table each night. The lakehouse needs an SCD type 2 history of the customers. Which API fits?
AAUTO CDC INTO with the snapshot table as the source
BA materialized view that selects from the latest snapshot
CAUTO CDC FROM SNAPSHOT over the nightly snapshots
DChange data feed on the snapshot table
Show the answer and why
AAUTO CDC INTO with the snapshot table as the source
Incorrect
AUTO CDC expects a change feed with operations and sequencing, not whole snapshots.
BA materialized view that selects from the latest snapshot
Incorrect
That shows only the current state, with no history.
CAUTO CDC FROM SNAPSHOT over the nightly snapshots
Correct
This API compares in-order snapshots to find inserts, updates and deletes, and supports SCD type 1 and type 2.
DChange data feed on the snapshot table
Incorrect
Overwriting the snapshot nightly produces no row-level history of customer changes.
Use AUTO CDC when the source has a change feed and AUTO CDC FROM SNAPSHOT when only snapshots are available. The snapshot API compares snapshots to determine changes and then applies them as SCD type 1 or type 2.
An AUTO CDC flow stored as SCD type 1 receives an update for customer 7 with sequence 6, and later an update for the same customer with sequence 5 arrives. What does the target hold for customer 7?
AThe values from sequence 6; the late update at sequence 5 is dropped
BThe values from sequence 5, because it was processed last by the flow
CBoth versions, with __START_AT and __END_AT columns added
DNo row, because out-of-order events fail the flow update
Show the answer and why
AThe values from sequence 6; the late update at sequence 5 is dropped
Correct
Records are ordered by the SEQUENCE BY column, so an older change that arrives late does not overwrite a newer one.
BThe values from sequence 5, because it was processed last by the flow
Incorrect
Arrival order does not decide the result; the sequence column does.
CBoth versions, with __START_AT and __END_AT columns added
Incorrect
Only SCD type 2 keeps versions with those columns.
DNo row, because out-of-order events fail the flow update
Incorrect
AUTO CDC handles out-of-order events instead of failing.
AUTO CDC uses the SEQUENCE BY column to order changes per key. In the documented example, an UPDATE at sequence 5 that arrived after one at sequence 6 was dropped from the SCD type 1 target.