Skip to content

Loading with merge, insert, and append

Azure Databricks uses Delta Lake's ACID-compliant operations—INSERT, MERGE, and DataFrame append writes—to load data into tables incrementally or as upserts. Choosing the right operation depends on whether you need simple appends, full overwrites, or conditional updates/inserts (upserts) based on matching keys. Understanding transaction guarantees and schema handling is essential for reliable, idempotent data loading pipelines.

1 · Learn the must-know

  • MERGE INTO performs upserts in a single atomic transaction, allowing matched rows to be updated or deleted and unmatched rows to be inserted.
  • INSERT INTO appends new rows to a Delta table without touching existing data, while INSERT OVERWRITE replaces the entire table or targeted partitions.
  • DataFrame writes using .mode("append") add rows to an existing table or path, and Delta enforces schema-on-write by default, rejecting mismatched schemas unless mergeSchema is enabled.
  • COPY INTO is idempotent and tracks previously loaded source files via table metadata, making it safe to rerun for incremental, append-only ingestion without creating duplicates.
  • MERGE performance depends heavily on the selectivity of the join/match condition and partition pruning; poorly chosen merge keys can force expensive full table scans.
  • Schema evolution during append or overwrite operations requires explicitly setting the mergeSchema or overwriteSchema option, since Delta Lake otherwise blocks incompatible schema changes to protect data integrity.

2 · Check your understanding

Check this objectiveFree · always available

A data engineer writes a MERGE INTO statement to upsert daily transaction records from a source DataFrame into a Delta table, matching on transaction_id. The job fails with an error stating that multiple source rows matched the same target row. What is the most likely cause and the correct fix?

Your objective map0 tried · 0 answered correctly · 77 untouched

What you have tried across DP-750's objectives, not a readiness score.

Set up and configure an Azure Databricks environment15-20% of the exam0 of 13 tried
Secure and govern Unity Catalog objects15-20% of the exam0 of 12 tried
Prepare and process data30-35% of the exam0 of 28 tried
Deploy and maintain data pipelines and workloads30-35% of the exam0 of 24 tried

3 · Keep going