A short walkthrough guide of setting up a scheduled query in BigQuery. The Google documentation for scheduled queries is here.
Step 1: Create a query in the bigQuery interface that is going to be run a scheduled intervals
INSERT `marquin-personal-tools.marquinsmith_dot_com.daily_stock_price` (stock_ticker, price, date, company)
SELECT
stock_ticker,
price,
date,
company
FROM
`marquin-personal-tools.marquinsmith_dot_com.stock_price_daily_update_raw`
WHERE stock_ticker IS NOT null
Step 2: Click the “schedule” button to open the settings form sidebar to configure the schedule
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-1024x368.png)
Step 3: Configure the settings for the scheduled query:
Give the scheduled query a name and decide a frequency
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-1-1003x1024.png)
If the query to be run regularly returns data (is a SELECT statement query) then it is possible to have those results populate into a table which is configured as part of this set up. With the results either be appended to the table or overwrite any potential data that is there already.
If the query to be run regularly does not return data (as in this case with an INSERT statement) then this section can be left blank.
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-2-918x1024.png)
Failure notifications can be set up (recommended), for instances when the scheduled query does not run for any reason
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-3-1009x1024.png)
Step 4: Click Save
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-5-929x1024.png)
This is what the configuration settings look like for the example query in this walkthrough
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-6-369x1024.png)
And that’s it. A scheduled query in BigQuery has now been set up and configured!!
See all scheduled queries
To see all of the scheduled queries that have been set up in the GCP project, navigate to the “Scheduled Queries” section within BigQuery by selecting it from the left hand side menu.
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-7.png)
Each row on the table on the “Scheduled Queries” is a scheduled query that has been set up. And at a glance as part of the table you can see the next run time and the name of each one.
![](https://marquinsmith.com/wp-content/uploads/2024/06/image-8-1024x338.png)