Use Snowflake TASK objects to run SQL statements automatically on a defined cron schedule or after another task completes.
How to schedule queries in Snowflake
Snowflake TASK objects let you automate recurring SQL so reports, ETL steps, and data quality checks run without manual effort.
A TASK is a first-class object that stores a SQL statement and a schedule. Snowflake’s engine wakes the task at the requested interval, spins up the assigned warehouse, executes the SQL, and shuts the warehouse down when idle.
Schedule queries when you need repeatable data loads, nightly aggregations, hourly data quality alerts, or event-driven chains that follow each other in order. Automation removes the risk of missed runs and keeps dashboards fresh.
Use CREATE TASK with the SCHEDULE option. Provide CRON expression, time zone, warehouse, and the SQL to run. Snowflake validates the cron string before saving.
The example below takes yesterday’s orders, sums revenue, and inserts into a reporting table. It runs at 01:00 UTC every day.
CREATE OR REPLACE TASK daily_revenue_snapshot
WAREHOUSE = reporting_wh
SCHEDULE = 'USING CRON 0 1 * * * UTC'
AS
INSERT INTO daily_order_revenue (snapshot_date, total_amount)
SELECT CURRENT_DATE - 1,
SUM(total_amount)
FROM Orders
WHERE order_date = CURRENT_DATE - 1;
New tasks are created in the SUSPENDED state. Use ALTER TASK … RESUME to activate, SUSPEND to pause, and SET to change the warehouse or schedule without recreation.
Yes. Replace SCHEDULE with AFTER <preceding_task>
. The child task fires only after the parent finishes successfully. Build multi-step pipelines without external orchestration.
Use a size-appropriate warehouse and AUTO_SUSPEND ≤60 seconds to control cost. Add COMMENT
for easy discovery. Keep SQL idempotent so reruns don’t duplicate data. Monitor task history via SNOWFLAKE.ACCOUNT_USAGE.TASK_HISTORY
.
No. A TASK accepts exactly one SQL statement. Wrap multiple steps in a stored procedure and call the procedure from the task.
Query ACCOUNT_USAGE.TASK_HISTORY or INFORMATION_SCHEMA.TASK_HISTORY to see error messages, SQL text, and execution times. Fix the SQL, then manually EXECUTE TASK to retest.
Yes. Use EXECUTE TASK task_name to trigger it immediately, regardless of the defined schedule.