Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Ingest data by using a change data capture (CDC) feed

A worked example

Multiple answers

You are completing the SQL flow in the exhibit for a Lakeflow pipeline. The source table bronze.customer_changes has the columns customer_id, name, department, region, last_login, operation, and sequence_num.

The source system sends partial update records. Every record includes non-null customer_id, operation, and sequence_num values. Among the name, department, region, and last_login columns, a record supplies values only for changed columns; unchanged columns are null.

The target customers_history must meet these requirements:

  1. Keep a full history of every change to the name, department, and region columns.
  2. A change to last_login must update the current row in place without creating a new version.
  3. Columns that a partial update record leaves null must keep their existing values in the target.

-- Excerpt: additional clauses are still to be added CREATE FLOW customers_history_flow AS AUTO CDC INTO customers_history FROM stream(bronze.customer_changes) KEYS (customer_id) SEQUENCE BY sequence_num COLUMNS * EXCEPT (operation, sequence_num)

Which three clauses should you add to the flow? Each correct answer presents part of the solution.

Choose 3 answers.
Why

Requirement 1 needs SCD Type 2, which keeps each earlier version and records when it was active. Requirement 2 needs TRACK HISTORY ON * EXCEPT (last_login), so last_login changes update the current record in place while changes to other columns still create versions. Requirement 3 needs IGNORE NULL UPDATES, because otherwise a partial update record would overwrite unchanged columns with nulls. SCD Type 1 fails the history requirement, and tracking history on last_login fails the in-place update requirement.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free