Designing Effective Data Pipelines in Snowflake
Instruction: Explain how you would design a data pipeline for processing real-time data in Snowflake.
Updated
Official answer
Define the freshness target from event creation to a queryable, correct result, including a percentile and tolerated lateness. “Real time” is not a sufficient service objective.
Select file-based Snowpipe or supported Snowpipe Streaming according to the source and required latency. File arrival notifications do not guarantee a fixed end-to-end delay. Preserve event ID, event time, ingest time and schema version in a durable raw layer.
Use streams/tasks when incremental DML processing fits the transformation. A stream tracks a change offset; querying it alone does not consume the changes. Consumption through a committed DML transaction advances the offset. Monitor staleness and recovery capacity so an outage does not outlive retained change history.
Transform with deterministic keys and explicit handling for duplicates, updates, deletes and late events. For example, replaying the same purchase must not double-count revenue. Separate retryable infrastructure failures from invalid input, and implement a quarantine/reprocessing path; a dead-letter queue does not appear merely because the design mentions one.
Commit related target changes consistently, record progress and test crash/retry boundaries. Consider dynamic tables for eligible declarative transformations, while checking their freshness and query limitations.
Monitor ingest lag, transform lag, completeness, rejection rate and downstream availability. Test peak load, delayed notifications, duplicate events and prolonged outages. Scaling and clustering choices should follow measured bottlenecks and costs, not a promise of automatic unlimited capacity.