BigQuery UI - How to schedule a query to run on the last day of the month? - google-bigquery

I have a query that pulls a summary of metrics for the past month that needs to run on the last day of each month at a set time.
The BigQuery 'Schedule query' UI allows you to choose a date and time to run a query each month but there is no apparent option to choose that last day of the month.
If I simply choose the 31st of the month, what happens if there are only 30-days in that month? Will the query still run?
Or do I have to schedule a query to run on the 27th, 28th, 29th, 30th, 31st of the month to make sure that I don't miss the correct date?
I can't find any mention of this situation in the BigQuery documentation or online so any help/suggestions will be very gratefully received.

I understand that you need to run your query in the last day of each month. However, if you set 31st of the month as the schedule options, it will skip the months which do not have 31 days.
You can check this affirmation, by performing the following test in the BigQuery UI:
In the Schedule query options, under Schedule options, set:
Repeats: Monthly
On the: 31
Start date and run time: set the date to 10th of June (which is a month with 30 days)
Click Schedule
On the left side of the BigQuery UI, click on Scheduled queries
Check the query you saved. Among other details, it should be displayed Next Scheduled.
It will be shown July, 31
As you can see, it skipped the 30th of June. Thus, when you configure your query to run on the 31st of each month, it will ignore the months with less than 31 days. For this reason, I would advise you to select 27th, 28th, 29th, 30th, 31st of each month in order to run it in a manner that suits you.
As a bonus information, you can set up a Custom schedule option, as mentioned here. You can use syntaxes as "1st monday of month 00:00" or "every monday 00:00", here.

Related

How to schedule biweekly SSRS subscription on 2017 report server

I would like my report to be sent biweekly on a Monday. Right now, I created two different subscriptions that sends the report on every 2nd and 4th week. I am not sure it would be accurate considering, I would like the send the report Monday after Pay period ends. What's a best way to approach to this?
A subscription can be created by Week and scheduled to repeat after 2 weeks. Monday can be selected as the day.
The schedule will show Every Monday of every two weeks.

Reoccurring SQL job to run on the 2nd and 4th Thursday of every month

I need a job to run on the 2nd and 4th Thursday of every month. I know I can set up a job to run every two weeks but that logic doesn't work when a month eventually hits a five week span. Is it possible to set this up using the SQL Server Agent Schedule? If not, does anyone recommend another method?
Create two schedules on the job, one that runs on the second Thursday, and one that runs on the fourth.
Under the Frequency heading on the Scheduler, change the Occurs drop down to Monthly to get to the options you need.

Get this week equivalent from last year

Working with SQL 2005 and I am trying to get this current weeks data equivalent from last year.
The week runs from Sunday to Friday. However as today is only Thursday I need the data from Sunday to Thursday from last year on this current date.
When I run the script again tomorrow it would need to be the data from a year ago for Sunday to - Friday.
Not really sure how to do this. Or even where to start, tried lots of things and lots of googling and not got anywhere, any suggestions?

Running APScheduler job the day before the 1st and 3rd Monday each month

I have an APScheduler job that creates a report our client has requested for the first and third Mondays of the month.
To deliver that in time, I want to run the job the day before the first and third Monday, which can't be specified directly in APScheduler.
I noticed another user had this question as well, describing the request as impossible, in the comments of Running APScheduler Job Every nth Day of Month
Here's how I solved it:
scheduler.add_job(func, 'cron', 'day_of_week'='sun', 'day'='last,1-6,14-20')
By specifying the day of the week, and then specifying the days in the month that could apply, it will fire the day before the first and third Mondays. It only fires when all the conditions are met, so the other dates (which won't be Sunday) don't fire.

Scheduling a SQL Job

what is the best way to schedule a SQL Job to run from (any date range) i.e. 15th to 18th every single month with no end date?
Thanks in advance.
john
SQL Server 2008 you can set the frequency to occur Monthly and have 3 or 4 individual schedules to occur on the 15th, 16th, 17th, and 18th day of each month. Similar to the below image.
Not the cleanest solution but it does work.