
Answer-first summary for fast verification
Answer: The entire history of updated records will overwrite the target table at each execution.
The query reads changes from the Delta table's Change Data Feed (CDF) starting from version 0 as a static source. By using `.mode("overwrite")` in the write operation, the target table 'customers_updates' is completely overwritten each time the query is executed, including all changes captured by the CDF from the specified starting version. This means the entire history of updates is written anew, not merged or appended. Reference: [Databricks Delta Change Data Feed Documentation](https://docs.databricks.com/delta/delta-change-data-feed.html#read-changes-in-batch-queries).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
When executing the following query on a Delta table named 'customers' with Change Data Feed enabled, what describes the outcome each time the query is run?
.option("readChangeFeed", "true")
.option("startingVersion", 0)
.table("customers")
.filter(col("_change_type").isin(["update_postimage"]))
.write
.mode("overwrite")
.table("customers_updates")
.option("readChangeFeed", "true")
.option("startingVersion", 0)
.table("customers")
.filter(col("_change_type").isin(["update_postimage"]))
.write
.mode("overwrite")
.table("customers_updates")
A
Newly updated records will be merged into the target table, modifying previous entries with the same primary keys.
B
Newly updated records will be appended to the target table.
C
Newly updated records will overwrite the target table.
D
The entire history of updated records will be appended to the target table at each execution, leading to duplicate entries.
E
The entire history of updated records will overwrite the target table at each execution.
No comments yet.