Study FAQ
How do Snowflake task graph dependencies and retries work?
Also asked as 2
- What happens to child tasks after an upstream failure, and where does a Snowflake graph retry begin?
- How should I order, activate, and recover a Snowflake task graph?
Answer
A Snowflake task graph has a root task and one or more dependent tasks defined with AFTER. The root defines when the graph starts. Ordinary children wait for their predecessor tasks to finish successfully, so a failed prerequisite stops the dependent path. Independent branches can have different results, which makes per-task history important.
Keep tasks in the same database and schema with the same owner role. Enable the required child tasks before resuming the root, or use the supported recursive enable function as the owner. Check execution and SQL privileges for the tasks. When changing the graph, suspend the root and account for any current run that is still completing.
Use task and graph history to identify the failed node, graph run, attempt, and executed query. EXECUTE TASK <root> RETRY LAST starts from failed or canceled tasks if the latest graph run is FAILED or CANCELED, the graph has not changed since that run, and the first attempt was within 14 days. The caller needs OWNERSHIP or OPERATE on the root and access to its database and schema. The task owner still needs its runtime privileges.
Root-level TASK_AUTO_RETRY_ATTEMPTS can automate retries. Design each mutation to tolerate replay and validate target freshness and totals after recovery. A graph dependency orders work, while each task still needs its own transaction and recovery design.
Task graph behavior and retries · EXECUTE TASK and retry prerequisites · TASK_HISTORY
Full explanation
Snowflake SQL Transformation, Streams, Tasks, and Pipeline Patterns
Study guide · COF-C03
Read the full explanation