Streams, Tasks, and Dynamic Tables
SnowPro Core · Lesson 18 of 27 · 2:08:48
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the SnowPro Core Certification exam (COF-C03). In this lesson: standard and append-only streams, tasks and task graphs, and dynamic tables. Follows Foxglove Apparel, a fictional online clothing retailer. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Process only what changed
Foxglove's raw orders land in a staging table all day long, and the clean orders table should only process the rows that changed. The cleanup must run on its own, every few minutes, or as soon as new rows arrive. Snowflake offers two ways to build this: streams and tasks, which you script yourself, or dynamic tables, which you simply declare.
Streams
A stream tracks the changes made to a table, which is called change data capture. It stores no table data itself, only an offset, a point in the table's history, and it returns the changes committed after that point. Each change row carries metadata columns: METADATA$ACTION says insert or delete, and METADATA$ISUPDATE marks the pair of rows that an update produces. Querying a stream does not move its offset: only a DML statement that reads the stream, and commits, consumes the changes and advances the offset.
Stream types and staleness
A standard stream tracks inserts, updates, and deletes, on tables, views, and dynamic tables. An append-only stream tracks inserts only, which makes it more efficient when a table only ever receives new rows. Insert-only streams play that role for external tables, and for externally managed Iceberg tables. A stream becomes stale if its changes are not consumed within the table's data retention period, so consume it regularly, for example with a scheduled task.
Tasks
A task runs a SQL statement, or a stored procedure call, on a schedule, such as every sixty minutes, or on a cron expression. It runs on serverless compute when you leave out the warehouse, and Snowflake sizes it within limits you can set, or it runs on a warehouse that you name. A triggered task runs when a stream has new data, with a WHEN clause that calls SYSTEM$STREAM_HAS_DATA. Tasks are created suspended: EXECUTE TASK runs a task once, for testing, and ALTER TASK RESUME starts its schedule.
Task graphs
Tasks can form a task graph, with a root task that defines when the graph runs, and child tasks created with AFTER, which name their parent tasks. Child tasks that share a parent can run in parallel, and a task with several parents waits for all of them. A finalizer task can run at the end of the graph, for cleanup, whatever the outcome. Combined, a stream and a task form an incremental pipeline: the task consumes the stream, and only when it has data.
Dynamic tables in pipelines
Dynamic tables are the declarative alternative: you write the SELECT that defines the result, and Snowflake works out the refreshes. The target lag sets how fresh each table must be, and DOWNSTREAM lets an intermediate table refresh only when the tables that read from it need fresh data. The ADAPTIVE refresh mode is the preferred choice for incremental workloads, while INCREMENTAL, FULL, and AUTO remain available. Snowflake infers the dependency graph from the queries, and refreshes the tables in order, from a consistent snapshot.
Choosing an approach
Choose dynamic tables when the result can be written as a query, and you want Snowflake to handle scheduling and dependencies. Choose streams and tasks when you need procedural logic, or fine control over each step. Dynamic tables do not accept stored procedures or external functions in their definition. And a materialized view remains the simplest choice for one table that must always be current, but it allows no joins.
Recap
Let's recap. A stream stores an offset and returns the changes since then, and only a committed DML statement advances it. Standard streams track all changes, append-only streams track inserts, and a stream goes stale if it is not consumed within the retention period. Tasks run on a schedule, or when a stream has data, on serverless compute or a warehouse, and they start suspended. Task graphs chain tasks from a root task, with AFTER, and a finalizer. And dynamic tables declare the result with a target lag, while Snowflake handles the refreshes.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Foxglove’s staging table only ever receives new rows from loads, and a job processes those new rows every hour. Which stream fits best?
- A standard stream on the table
- An insert-only stream on the table
- An append-only stream on the table
- A directory table on the stage
Show the answer
An append-only stream on the table
An append-only stream returns only the inserted rows, which makes it more efficient than a standard stream in this case. “A standard stream on the table” would also work, but it tracks updates and deletes that never happen here. “An insert-only stream on the table” is meant for external tables, and for externally managed Iceberg tables. And “A directory table on the stage” lists files on a stage, not new rows in a table.
Foxglove creates a task that should merge staged orders every ten minutes. Hours later, it has never run, and the task history shows no error. What is the most likely cause?
- The task was never resumed after creation
- A serverless task must name a warehouse
- Tasks only run on triggers, not on schedules
- A schedule must be written as a cron expression
Show the answer
The task was never resumed after creation
Tasks are created suspended, so the schedule only starts after ALTER TASK RESUME. “A serverless task must name a warehouse” is wrong, because leaving out the warehouse makes the task serverless. “Tasks only run on triggers, not on schedules” is wrong, since tasks can run on a schedule, or on a trigger. And “A schedule must be written as a cron expression” is wrong, because a schedule in minutes is valid too.
Foxglove wants a precomputed daily sales summary that joins orders, customers, and products, no more than 15 minutes behind the sources, with no scheduling code. What fits best?
- A materialized view joining the three tables
- A stream and a task on each source table
- A standard view over the three tables
- A dynamic table with a 15-minute target lag
Show the answer
A dynamic table with a 15-minute target lag
A dynamic table stores the joined result, and Snowflake refreshes it to stay within 15 minutes, with no scheduling code. “A materialized view joining the three tables” is wrong, because a materialized view cannot join tables. “A stream and a task on each source table” would work, but it means writing and scheduling the merge logic yourself. And “A standard view over the three tables” stores nothing, so the joins would run again on every query.