YoungboyVBA
YoungboyVBA

Reputation: 317

Running a Snowflake Task on the first non-weekend day of the month (using cron)

Right now, I only know how to set it to the first of the month (irrespective of whether it's a weekend). The sample code from the task is a follows:

SCHEDULE = 'USING CRON 0 2 1 * * Europe/Dublin'

Upvotes: 0

Views: 533

Answers (1)

Gokhan Atil
Gokhan Atil

Reputation: 10059

I don't think it is possible to schedule a task to run on the first non-weekend day of the month.

Workaround:

  1. Schedule your job to run on days 1-3 and call a stored procedure
  2. Inside your SP, check if the job is already executed this month (you may use a table to persist the last run)
  3. Insider your SP, check if it's a weekday, else end the SP without executing the rest of the task

Upvotes: 1

Related Questions