Schedule snowflake task to run once a month

2.6k views Asked by At

I would like to schedule my snowflake task to run once a month. It can be 1st day of the month at 12 AM. I suppose I should use cron statements. I tried to do it like this but I am still getting an error

    SCHEDULE = ' Using Cron 0 0 1 * * /usr/bin/foo'

I Have Also tried this

    SCHEDULE = ' Using Cron 10 0 1 * * America/Los_Angeles'

Invalid schedule was specified. Please refer to the docs on what constitutes a valid schedule.

Are you able to help me with this?

2

There are 2 answers

0
Marcel On

You can use this site to generate a cron expression: http://www.cronmaker.com/

First monday of the month would be http://www.cronmaker.com/;jsessionid=node01jfgbcdpvcuyq11hdbfo9xv9yz104070.node0?0

0
Aditya Tiwari On

Your cron schedule looks good to be executed for 1st of every month at 12AM.

Sometimes it fails because of special characters in SCHEDULE line and specially between the numbers and asterisk (*) if it has been copied from somewhere.

 SCHEDULE = ' Using Cron 0 0 1 * * /usr/bin/foo'

So you can try rewriting above line and it should work.

More information on cron scheduling on this link

https://en.wikipedia.org/wiki/Cron