Study FAQ
What does a Snowflake stream record, and when does its offset advance?
Also asked as 2
- Does SELECT consume a Snowflake stream, and how are updates represented?
- What changes appear in Snowflake streams, and which operation moves the offset?
Answer
A Snowflake stream tracks a change offset for its source object and exposes changes using source metadata. It does not hold a standalone copy of a durable change log. A plain SELECT leaves the offset in place. When a qualifying DML transaction reads the stream and commits, the offset advances. A rolled-back transaction leaves the offset available to retry.
For a standard stream, inspect METADATA$ACTION and METADATA$ISUPDATE. An update to an existing row typically appears as a DELETE for the old image and an INSERT for the new image, both marked as an update. The stream exposes a net change set between offsets, so intermediate operations can cancel or collapse. A row inserted and subsequently updated before consumption can appear as a single INSERT. Append-only streams on supported objects track inserts and omit update and delete operations.
Use a diagnostic SELECT to inspect business keys and metadata before implementing a transform. Test insert, update, delete, and rollback cases on representative data, then consume through DML such as INSERT or MERGE as appropriate. Use a separate stream for another consumer that needs its own offset.
Stream offsets and transaction semantics · Standard and append-only stream examples
Full explanation
Snowflake SQL Transformation, Streams, Tasks, and Pipeline Patterns
Study guide · COF-C03
Read the full explanation