Cleanse, Transform, and Load Data
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing Implementing Data Engineering Solutions Using Azure Databricks premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Read the data before you reshape it
- Type and parse on the way in
- Cleanse: duplicates, nulls, and null-safe logic
- Transform with set-based SQL
- Reshape and denormalize for the gold layer
- Load idempotently: MERGE, append, and overwrite
- Exam-pattern recognition
Choosing a Delta load mode: append, overwrite, REPLACE WHERE, MERGE INTO
| Aspect | INSERT INTO (append) | INSERT OVERWRITE | REPLACE WHERE | MERGE INTO |
|---|---|---|---|---|
| What it does | Adds new rows only | Replaces the whole table's data | Atomically overwrites rows matching a predicate | Matches source to target on keys, then updates, deletes, or inserts |
| Corrects existing rows? | No | Yes, all of them | Only within the predicate range | Yes, by key |
| Idempotent re-run? | No; a re-append double-loads | Yes; a full replace | Yes; same predicate reloads the same range | Yes; matched keys upsert once |
| Typical use | Incremental bronze append | Full refresh of a table | Reload one day, region, or partition range | CDC upsert, SCD maintenance, deduplicating load |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
References
- Databricks Utilities (dbutils) reference
- https://learn.microsoft.com/en-us/azure/databricks/notebooks/eda-tutorial
- Data profiling
- DECIMAL type
- try_cast function
- cast function
- Query variant data
- Query JSON strings
- dropDuplicates
- dropDuplicatesWithinWatermark
- Apply watermarks to control data processing thresholds
- coalesce function
- NULL semantics
- equal_null function
- GROUP BY clause
- HAVING clause
- Work with joins on Azure Databricks
- JOIN
- Set operators
- PIVOT clause
- UNPIVOT clause
- MERGE INTO
- Upsert into a Delta Lake table using merge
- AUTO CDC INTO (pipelines)
- Selectively overwrite data with Delta Lake
- INSERT