Snowflake Tasks multiple schedule

1.2k views Asked by At

I have created a task and scheduled it using cron though I need to run the task at different times during week/weekend. is this possible? the only option I can think of creating two tasks one for week days run and another for weekend.

2

There are 2 answers

0
Marcel On

No, it's not possible to create a task with 2 different/separate schedulings (with this I mean e.g. two cron expressions).

Consequence: You have to express your desired task-schedule with 1 single cron expression. If this is not possible, you have to split it into several tasks like you mentioned.

More info: https://docs.snowflake.com/en/sql-reference/sql/create-task.html

0
Limonka On

I would create another task, that alters your task.

It would run once a day, and run a stored procedure, which could check current day of week, and perform "CREATE OR REPLACE TASK" command with appropriate schedule.

This solution might be useful for more complex schedules, eg. we want data transformation to run every 5 mins during business hours, every 30 mins 6am-8am and 5pm-10pm, and every even hour at night.