Streams + Tasks: understand every change
Learn what a stream remembers, what a task executes, and what must commit together. Follow one order pipeline through duplicates, updates, deletes, failure, retry and recovery.
Before you begin
Complete Module 10 and the Module 04 MERGE/window/transaction foundations. These exercises do not depend on unfinished Track 2 cloud ingestion setup.
15 lessons · About 375 minutes of detailed study, plus manual practice. Work across several sessions at your own pace. Read the explanation first, predict results, then optionally run the SQL.
Create M11_LAB using lesson 1. Use an authorized role and warehouse. Task activation needs additional account privileges and can incur compute costs. Replace warehouse placeholders, keep demo tasks suspended and never run the task and graph concurrently against the shared consumer.
Start with CDC →The learning path
Lessons 1–6 explain streams. Lessons 7–8 explain task execution. Lessons 9–15 build, automate, monitor and recover one pipeline. Follow the order to keep sample state consistent.
- Lesson 1 · About 25 min
CDC: process what changed instead of rereading everything
Change data capture, or CDC, identifies changes after a known point so downstream processing can work incrementally.
Read, explore and practise → - Lesson 2 · About 25 min
Read inserts, deletes and update pairs
A standard stream exposes net row changes with metadata explaining the operation and row identity.
Read, explore and practise → - Lesson 3 · About 25 min
Offsets, consuming DML and rollback
SELECT inspects a stream. A committed transaction that consumes it through DML advances its offset; rollback preserves the unconsumed changes.
Read, explore and practise → - Lesson 4 · About 25 min
Choose standard, append-only or insert-only streams
Stream types expose different changes and apply to different supported source objects. Choose the type from the source and required semantics.
Read, explore and practise → - Lesson 5 · About 25 min
Independent consumers, retention and stale streams
Each independent consumer should have its own stream offset. Retention limits how long unconsumed change history remains usable.
Read, explore and practise → - Lesson 6 · About 25 min
What SYSTEM$STREAM_HAS_DATA does—and does not prove
SYSTEM$STREAM_HAS_DATA is a lightweight change check useful in task conditions. TRUE can be a false positive, so the processing SQL must tolerate an empty stream.
Read, explore and practise → - Lesson 7 · About 25 min
Tasks: compute, ownership and one manual run
A task runs a SQL statement or procedure under its configured execution identity. It needs both compute configuration and permission to perform the work.
Read, explore and practise → - Lesson 8 · About 25 min
Schedules, CRON and triggered execution
A schedule decides when to check for work. A triggered task reacts to a supported condition without a polling schedule.
Read, explore and practise → - Lesson 9 · About 25 min
Pipeline contract: immutable events, versions and tombstones
Reliable incremental processing needs an ordering contract. Our pipeline stores immutable events and maintains one latest state per order, including deletion markers.
Read, explore and practise → - Lesson 10 · About 25 min
Consume, deduplicate and MERGE in one transaction
The processing procedure stages the current interval, validates it and updates target state before committing the stream offset with the data.
Read, explore and practise → - Lesson 11 · About 25 min
Prove rollback, retry, deletes and older-event replay
Failure testing should demonstrate that uncommitted target changes and stream advancement are both undone, then show that replay does not regress current state.
Read, explore and practise → - Lesson 12 · About 25 min
Run the consumer through a triggered task
Connect a task to the stream signal and let its body call the same transaction-owning procedure already exercised manually.
Read, explore and practise → - Lesson 13 · About 25 min
Task graphs: dependencies, roots and finalizers
A task graph orders related work. A child runs after its predecessors; a finalizer handles end-of-run actions without pretending a failed business step succeeded.
Read, explore and practise → - Lesson 14 · About 25 min
Monitor failures, timeouts and retries without duplicating work
Use task history and business state together. A failed or skipped task needs a different response from a successful run whose business result is wrong.
Read, explore and practise → - Lesson 15 · About 25 min
Recovery and final lab: preserve the boundary and prove the state
A recovery plan must explain what data was lost, what source can reconstruct it and where normal incremental processing resumes.
Read, explore and practise →
What you should be able to explain
Why SELECT does not consume a stream; why an update has two change rows; why a failed transaction preserves pending work; why a tombstone prevents an old event from restoring a deleted order; and why a successful task submission is not proof of a successful pipeline.
Return to the curriculum →Module 12 — Dynamic Tables & Declarative Pipelines comes next.