English · IndiaLog in
Rackwave Technologies
Request quote Free consultation
DataUpdated 26 Nov 2026

Snowflake Streams and Tasks: Build Incremental Pipelines

Snowflake streams and tasks: CDC, task graphs, incremental merges and monitoring.

Written by Rohan Verma
  • Published25 Nov 2026
  • Read time7 min
  • Length1,322 words
Share this guide

What are Snowflake streams and tasks? Streams and tasks are the native Snowflake pair for change-driven data pipelines. A stream records the changes made to a table, and a task runs SQL on a schedule or when new data appears. Together they let you build incremental transformations and simple orchestration without an external scheduler. This guide explains how streams capture change data, how tasks and task graphs run, how to combine them into a reliable pipeline, how to handle errors and cost and when a dynamic table or external tool is a better fit. Features change, so confirm details in current Snowflake documentation.

Short answer: A stream tracks inserts, updates and deletes on a table since you last consumed them. A task runs SQL on a schedule or chain. Use them together to process only new data, and check the stream has data before running costly work.

What is a stream?

A stream is an object that sits on a table, view or similar source and records change data capture information. It does not copy the data. It keeps an offset, so a query on the stream returns the rows that changed since the offset, along with metadata columns that say whether each row was inserted or deleted and whether it is part of an update. When you consume the stream in a DML statement, the offset advances. It is the Snowflake form of change data capture inside the platform.

Streams and tasks diagram
Figure 1. Streams and tasks: raw table, stream, task and how they relate.

What is a task?

A task is a scheduled unit of SQL or a call to a stored procedure. A task can run on a fixed interval or a cron schedule, and tasks can be chained into a graph where child tasks start after parent tasks finish. A task uses either a warehouse you name or serverless compute that Snowflake manages. Tasks make it easy to orchestrate straightforward pipelines, while more complex workflows may still use Apache Airflow or a similar tool.

Streams and tasks together

  1. Land raw data. Load files or rows into a raw table, for example with Snowpipe.
  2. Create a stream on the raw table. The stream tracks new rows as they arrive.
  3. Create a task that checks the stream. Add a condition so it runs only when the stream has data.
  4. Merge into the curated table. Use a MERGE or INSERT that reads from the stream, which consumes the changes.
  5. Chain downstream tasks. Refresh marts or aggregates after the merge completes.
  6. Monitor and alert. Track task history, failures and lag.

Stream types and metadata

ItemWhat it means
Standard streamTracks inserts, updates and deletes on a table
Append-only streamTracks inserts only, useful for event or log tables and cheaper to maintain
Metadata actionWhether the row was inserted or deleted
Metadata is-updateMarks insert and delete pairs that represent an update
OffsetThe point up to which changes have been consumed

Updates appear as a delete of the old row and an insert of the new one, so write MERGE logic with that in mind.

Writing a task graph

A root task holds the schedule and child tasks run after it. Keep each task small and focused so failures are easy to find and restart. Use the system function that checks whether a stream has data in the task condition so an empty run costs almost nothing. Choose serverless tasks for small, bursty jobs and a dedicated warehouse for heavy transformations that need predictable sizing, as described in virtual warehouses.

CREATE TASK curate_orders
  WAREHOUSE = transform_wh
  SCHEDULE = '5 MINUTE'
  WHEN SYSTEM$STREAM_HAS_DATA('raw.orders_stream')
AS
  MERGE INTO curated.orders t
  USING raw.orders_stream s ON t.order_id = s.order_id
  WHEN MATCHED THEN UPDATE SET t.status = s.status
  WHEN NOT MATCHED THEN INSERT (order_id, status) VALUES (s.order_id, s.status);

This is a simplified pattern. Handle deletes and the metadata columns that fit your data, and test with real changes.

Reliability and error handling

  • Make merges idempotent, so a retried run does not duplicate rows.
  • Remember that a stream offset advances only when a transaction that reads it commits, so a failed task does not lose changes.
  • Watch for stream staleness. If a stream is not consumed for longer than the source retention allows, it can become stale and need to be recreated and the gap reloaded.
  • Set task retry and error notifications, and log run results to an audit table.
  • Suspend tasks during deployments and resume them after validation.

Streams and tasks compared with alternatives

OptionStrengthLimit
Streams and tasksFull SQL control, native, event awareYou manage logic, ordering and errors
Dynamic tablesDeclarative, define the result and target lagLess control over each step
External orchestratorRich scheduling, cross-system dependenciesMore infrastructure to run
dbt incremental modelsVersion controlled SQL with testingNeeds a scheduler and runs on warehouse

See dynamic tables for the declarative approach and dbt for tested transformation projects.

Monitoring and cost control

Query the task history to see run status, duration and errors, and the stream status to check whether changes are waiting. Alert when a task fails, when it has not run for longer than expected or when the stream backlog grows. For cost, prefer a condition on stream data over a tight schedule, size the warehouse to the merge and not to the busiest day, and review serverless task credits in the usage views each month. Document each pipeline with its source, target, schedule, owner and recovery steps so any engineer can take over.

SignalWhat to watchAction
Task failuresError text and repeat countFix logic, then resume the task
Run durationTrend over weeksTune the merge or resize compute
Stream backlogRows waiting between runsRun more often or in smaller batches
Stale stream warningAge against source retentionRecreate stream and backfill
Credits per pipelineServerless and warehouse useRight-size or reduce frequency

Common mistakes

  • Scheduling a task every minute with no stream check, so it runs warehouse time for nothing.
  • Consuming a stream in a SELECT only and expecting the offset to advance.
  • Writing logic that ignores deletes and update pairs.
  • Letting a stream go stale after a long pause.
  • Building one giant task that is hard to test and restart.

A worked example

An online marketplace loads order events into a raw table. A stream on that table feeds a five-minute task that merges changes into a curated orders table, followed by two child tasks that refresh a daily revenue summary and a customer status table. The task graph runs only when the stream has data, so quiet hours cost almost nothing. A final task writes a row to a monitoring table with counts and duration.

When a bad file once produced duplicate order ids, the team fixed the merge to deduplicate by the latest event time and replayed the raw data. Because the pipeline was idempotent, the repair needed no manual deletes. The details are illustrative.

Governance and support

Give pipeline tasks a dedicated role with only the privileges they need, following access control. Keep task definitions in version control and deploy them through a pipeline, not by hand. Our data warehousing service designs these pipelines, and our data analytics service builds the models on top.

Key takeaways

  • Streams capture changes without copying data.
  • Tasks run SQL on schedules or after other tasks.
  • Check the stream before running so empty runs cost little.
  • Make merges idempotent and watch for stale streams.
  • Choose dynamic tables for declarative needs and tasks for control.

Quick glossary

TermMeaning
StreamAn object that tracks table changes since the last consumption
TaskA scheduled unit of SQL or a procedure
OffsetThe point up to which a stream has been consumed
Task graphA chain of dependent tasks
IdempotentSafe to run more than once with the same result

Read next: BigQuery vs Snowflake: Which Cloud Data Platform? · BigQuery Streaming Inserts: Real-Time Ingestion Guide · BigQuery Access Control: IAM, Policy Tags and Row Security

Frequently asked questions

What is a Snowflake stream?

A stream records the changes made to a table since the last time they were consumed, giving you change data capture inside Snowflake.

What is a Snowflake task?

A task runs SQL or a stored procedure on a schedule or after another task, and can be chained into graphs.

Do streams copy data?

No. A stream stores an offset and returns changed rows when queried, without copying the table.

How does a stream represent an update?

As a delete of the old row and an insert of the new one, with metadata columns that identify them.

When does a stream offset advance?

When the stream is consumed in a DML statement that commits, not when it is only queried.

Can a task run only when new data exists?

Yes. Use a condition that checks whether the stream has data so empty runs are skipped.

What happens if a stream becomes stale?

Changes older than the source retention window may be lost to the stream, so you must recreate it and reload the gap.

Should I use tasks or dynamic tables?

Use tasks when you need control over each step, and dynamic tables when you prefer to declare the result and target freshness.

Was this guide helpful?Your answer helps us decide what to improve. It is not linked to you.

#snowflake streams and tasks#snowflake streams#snowflake tasks#snowflake change data capture#snowflake task graph

About the author

Rohan Verma

Data Platforms Consultant

Rohan works across CDP, data warehouse, and analytics platform implementations, helping clients figure out which data infrastructure actually fits their scale rather than defaulting to whatever's currently trending.

Data Platforms & Technical Architecture

Ready to put AI and data to work?

Book a free consultation and leave with a plan, not a pitch.

Get a free consultationRequest quote