Search code examples
snowflake-cloud-data-platformcron-task

How to schedule a snowflake task to run multiple times every day on a specified times


I have a snowflake task that i want to execute it 6 time in a day, for everyday. I want to run on below mentioned time

8.30 pm cst
12.30 am cst
3.30 am cst
7.30 am cst
9.30 am cst
12.30 pm cst

Will this be a correct snowflake task schedule cron expression

SCHEDULE='30 20,0,3,7,9,12 * * *'

Is there any way that i can specify this schedule in snowflake task using single cron expression?

I want to know the cron expression that will run as per specified schedule.

I want to avoid creating multiple task for different schedule.


Solution

  • CST is 6 hours behind UTC. You can adjust your schedule accordingly

    USE ROLE ACCOUNTADMIN;
    
    CREATE OR REPLACE TASK Snow_task
    WAREHOUSE=compute_wh
    SCHEDULE = 'USING CRON 30 20,0,3,7,9,12 * * * UTC'
    AS
    SELECT CURRENT_TIMESTAMP;
    

    https://docs.snowflake.com/en/sql-reference/sql/create-task#single-sql-statement