Arman Pouyaei Start a conversation
Lesson 17  ·  Oct 26, 2026
Data Engineering Fundamentals

Only load what's new: incremental ingestion

So far the lake has been a pile of files you rewrite or append to. But real pipelines run on a schedule — hourly, daily — and re-reading the entire source every run is the most expensive habit in data engineering. Incremental ingestion flips it: each run loads only the rows that are new or changed since the last good run. The cost of a run stops scaling with the size of your table and starts scaling with how much actually changed.

The code

-- Load only rows newer than the last successful run
INSERT INTO storm_readings
SELECT station_id, recorded_at, temp_c, lat, lon
FROM staging.storm_readings
WHERE recorded_at > (SELECT MAX(recorded_at) FROM storm_readings);

The recorded_at column is the watermark: the high-water mark of what you have already loaded. The subquery reads the latest timestamp already in the lake table, and the WHERE clause keeps only staging rows above that line. Run it hourly and each run moves a thin slice of new sensor readings into the lake — the 10 million rows already there are never re-read.

In practice

Three things to get right. Pick a watermark that only moves forward. A timestamp like recorded_at or updated_at is the usual choice; if the source timestamps lie or drift, a monotonic sequence or version number is safer. The first run is special: the lake table is empty, so there is no watermark yet — the first run loads everything, and every run after that is incremental. Know what a watermark can’t see. It catches inserts and updates that bump the timestamp, but a row hard-deleted in the source simply never appears — deletes need a different mechanism, either a soft-delete flag, a snapshot comparison, or the heavier tool: change data capture (CDC), where the source database streams every insert, update, and delete as events. CDC is the watermark idea taken to its limit, and it is what most production pipelines graduate to.

In your world: hourly storm-sensor batches land in staging, the watermark query appends only the new readings to the partitioned lake table from Lesson 15, and the table formats from Lesson 16 handle the late corrections with MERGE. Small runs, fresh data, no full re-reads.

Python bridge: this is the same idea as an incremental backup versus a full backup — or, in pandas terms, df[df.recorded_at > last_loaded] before you append. The watermark is just the last_loaded value, persisted in the table itself instead of a variable.

Further reading

Incremental Loading — Coalesce Documentation (a clear, beginner-friendly rundown of full refresh vs incremental loads, watermarks, and CDC, with the pitfalls to watch for)

Try it

Practice question: the lake table storm_readings already holds readings through 2026-10-25 18:00. Write a query that returns only the new rows from staging.storm_readings — just station_id, recorded_at, and temp_c — using a watermark instead of a hardcoded timestamp. What does the query return?

Show answer
SELECT station_id, recorded_at, temp_c
FROM staging.storm_readings
WHERE recorded_at > (SELECT MAX(recorded_at) FROM storm_readings);

Result: only the rows recorded after 2026-10-25 18:00 — the new readings that arrived since the last run. Every older row is skipped without being read into the result, and because the watermark comes from the table itself, the same query works unchanged on the next run too.

← All posts