2

Can we trigger snowflake task manually or enable to run at a specific day and time?

if the above is not feasible. Any other alternative ideas?

ADom
  • 151
  • 1
  • 9
  • 1
    Yes - did you check the docs? Did you have a problem trying them out? Please let us know – Felipe Hoffa Nov 15 '21 at 19:35
  • You schedule it like CRON; anything in CRON you can do you should be able to do in TASKS, like Felipe said, it's in the docs – patrick_at_snowflake Nov 15 '21 at 21:12
  • @FelipeHoffa I am getting an error "Invalid schedule was specified. Please refer to the docs on what constitutes a valid schedule. " while trying a CRON like this CREATE OR REPLACE TASK HIST_INSERT WAREHOUSE = $WH SCHEDULE = 'USING CRON 0 0 17 15 America/Los_Angeles 11/1 ? 2021' – ADom Nov 15 '21 at 23:44
  • I am getting an error "Invalid schedule was specified. "2021" is not a recognized time zone. Please specify time zones accepted by the TIMEZONE parameter. " while trying a CRON like this CREATE OR REPLACE TASK HIST_INSERT WAREHOUSE = $WH SCHEDULE = 'USING CRON 0 0 22 15 11 ? 2021' – ADom Nov 16 '21 at 00:12

2 Answers2

0

When using USING CRON the following format is accepted:

# __________ minute (0-59)
# | ________ hour (0-23)
# | | ______ day of month (1-31, or L)
# | | | ____ month (1-12, JAN-DEC)
# | | | | _ day of week (0-6, SUN-SAT, or L)
# | | | | |
# | | | | |
  * * * * *

There is no year option, so something like this would work:

'USING CRON 0 9-17 * * SUN America/Los_Angeles'
  • every hour starting at 9 AM and ending at 5 PM on Sundays (America/Los_Angeles time zone)
Sergiu
  • 4,039
  • 1
  • 13
  • 21
0

Yes, it is possible to run task manually using EXECUTE TASK

Manually triggers an asynchronous single run of a scheduled task (either a standalone task or the root task in a task tree) independent of the schedule defined for the task.

A successful run of a root task triggers a cascading run of child tasks in the tree as their precedent task completes, as though the root task had run on its defined schedule.

EXECUTE TASK <task_name>;
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275