SnowPro Core Streams and Tasks 2 — Questions and Answers
Question 1: What is the primary purpose of a Snowflake Task?
- To monitor virtual warehouse credit consumption in real time
- To schedule and execute a SQL statement or stored procedure on a recurring basis (Correct answer)
- To replicate data between two Snowflake accounts in different regions
- To manage row-level access control policies on sensitive tables
Correct answer: To schedule and execute a SQL statement or stored procedure on a recurring basis
Snowflake Tasks are used to schedule a single SQL statement or stored procedure call to execute at a defined interval or cron schedule, enabling automated data pipelines.
Question 2: Which syntax correctly schedules a Snowflake Task to run every day at midnight UTC?
- SCHEDULE = '0 0 * * *'
- INTERVAL = '1 DAY' AT '00:00 UTC'
- SCHEDULE = CRON '0 0 * * * UTC'
- SCHEDULE = 'USING CRON 0 0 * * * UTC' (Correct answer)
Correct answer: SCHEDULE = 'USING CRON 0 0 * * * UTC'
Snowflake cron-based task schedules require the format SCHEDULE = 'USING CRON <expression> <timezone>', for example SCHEDULE = 'USING CRON 0 0 * * * UTC'.
Question 3: What must you do before a newly created Snowflake Task will begin executing on its schedule?
- Grant EXECUTE TASK privilege to the PUBLIC role
- Run ALTER TASK <task_name> RESUME to activate it (Correct answer)
- Set AUTOSTART = TRUE in the task definition
- Attach the task to a running virtual warehouse first
Correct answer: Run ALTER TASK <task_name> RESUME to activate it
Newly created tasks are in a SUSPENDED state by default; you must explicitly run ALTER TASK <name> RESUME to activate scheduled execution.
Question 4: What is a Snowflake Task DAG (Directed Acyclic Graph)?
- A visual dashboard for monitoring warehouse credit usage over time
- A root task that triggers on a schedule with one or more dependent child tasks that run in order (Correct answer)
- A schema-level view of all table relationships and foreign keys
- A billing report that groups task costs by department or cost center
Correct answer: A root task that triggers on a schedule with one or more dependent child tasks that run in order
A task DAG is a tree of tasks where a root task runs on a defined schedule and triggers child tasks upon completion, allowing complex multi-step pipeline orchestration.
Question 5: What is the maximum number of child tasks that a single parent task can have in a Snowflake task DAG?
- 1
- 10
- 100 (Correct answer)
- Unlimited
Correct answer: 100
A single task node in a Snowflake DAG can have up to 100 child tasks, enabling broad parallel branching in complex pipeline workflows.
Question 6: Which account-level privilege is required for a role to own and execute Snowflake Tasks?
- USAGE on the database containing the task
- EXECUTE TASK on the account (Correct answer)
- OWNERSHIP on all tables referenced in the task's SQL
- OPERATE on the virtual warehouse used by the task
Correct answer: EXECUTE TASK on the account
The EXECUTE TASK privilege must be granted at the account level to allow a role to run scheduled task executions; without it, tasks owned by that role will fail.
Question 7: How can a Snowflake Task be configured to skip execution when there is no new data to process in a stream?
- Set SKIP_IF_EMPTY = TRUE in the CREATE TASK statement
- Use a WHEN SYSTEM$STREAM_HAS_DATA('<stream>') clause in the task definition (Correct answer)
- Enable AUTO_SKIP on the stream object
- Set STREAM_CONDITION = TRUE in task parameters
Correct answer: Use a WHEN SYSTEM$STREAM_HAS_DATA('<stream>') clause in the task definition
Adding WHEN SYSTEM$STREAM_HAS_DATA('<stream_name>') to a CREATE TASK statement causes Snowflake to skip the task run if the stream contains no unconsumed change records.
What is the primary purpose of a Snowflake Task?