Skip to content

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?

  1. AAdd last_login to the COLUMNS * EXCEPT list of the flow
  2. BChange the flow to STORED AS SCD TYPE 1
  3. CAdd TRACK HISTORY ON * EXCEPT (last_login) to the flow
  4. 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.

Question 2 · choose 1

A pipeline on classic compute with the Core edition fails when an AUTO CDC flow is added. What is required to use the AUTO CDC APIs?

  1. AContinuous pipeline mode instead of the default triggered mode
  2. BServerless, or the Pro or Advanced edition on classic compute
  3. CChange data feed turned on for the target streaming table
  4. DThe Advanced edition, because the Pro edition does not include CDC
Show the answer and why
  • AContinuous pipeline mode instead of the default triggered mode

    Incorrect

    AUTO CDC works in triggered and continuous mode.

  • BServerless, or the Pro or Advanced edition on classic compute

    Correct

    The CDC APIs need serverless or the Pro or Advanced editions.

  • CChange data feed turned on for the target streaming table

    Incorrect

    The target is managed by the flow; this is not the requirement.

  • DThe Advanced edition, because the Pro edition does not include CDC

    Incorrect

    Both the Pro and Advanced editions support the CDC APIs.

To use the AUTO CDC APIs, a pipeline must use serverless or the Lakeflow pipelines Pro or Advanced edition.

Question 3 · choose 1

A dimension table is maintained by AUTO CDC as SCD type 2. Which filter returns only the current version of each key?

  1. AWHERE __START_AT IS NULL
  2. BWHERE _change_type = 'insert'
  3. CWHERE __END_AT = __START_AT
  4. DWHERE __END_AT IS NULL
Show the answer and why
  • AWHERE __START_AT IS NULL

    Incorrect

    Every version has a __START_AT value.

  • BWHERE _change_type = 'insert'

    Incorrect

    _change_type is a change data feed column, not an SCD target column.

  • CWHERE __END_AT = __START_AT

    Incorrect

    That does not identify the active version.

  • DWHERE __END_AT IS NULL

    Correct

    Active versions have a null __END_AT; ended versions have a value.

SCD type 2 targets keep each version of a record with __START_AT and __END_AT columns. Rows with a null __END_AT are currently active.

Question 4 · choose 1

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?

  1. AAUTO CDC INTO with the snapshot table as the source
  2. BA materialized view that selects from the latest snapshot
  3. CAUTO CDC FROM SNAPSHOT over the nightly snapshots
  4. 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.

Question 5 · choose 1

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?

  1. AThe values from sequence 6; the late update at sequence 5 is dropped
  2. BThe values from sequence 5, because it was processed last by the flow
  3. CBoth versions, with __START_AT and __END_AT columns added
  4. 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.

Practice domain 1 →Practice all domains →