Schedule a query

Setting up and configuring your scheduled queries.

Using superQuery's scheduler is not the same as using BigQuery's.

To schedule a query, first open the tab containing the query you'd like to schedule. If the query hasn't been written yet, open a new tab and write out the SQL.

Then, click on the scheduler icon that appears to the right of your query tabs (show below).

Scheduler Settings

Before scheduling your query, you'll need to set up the scheduler.

Your query scheduler settings (screenshot at the end) contain four main sections:

Query details

  • Give your scheduled query a recognizable name. This will help you identify the query if you have multiple scheduled queries.

  • By default, the name you've given the query tab will be used.

Set up scheduler interval

  • Determine how often you'd like the query to execute.

  • Select one of the preset options in the dropdown, or customize your interval.

  • For custom intervals, refer to this article and this article if you need help setting up the proper notation.

Set up the query's destination table

  • This is just like setting up a destination table for a regular query.

  • Give the table a recognizable name, and decide whether you'd like the results to append to or overwrite the table's previous results.

Notification options

  • Decide whether you'd like to receive alerts when the query executes successfully, fails, or both.

Note: When you are scheduling a query that contains variables, the variable will execute as a literal value.

Scheduling a sequence of DML scripts

You can save tons of time by setting up a series of DML statements to execute in a sequence — and how to schedule these in a single scheduler. It might look a little bit like this:

CREATE TABLE IF NOT EXISTS `myproject.mydataset.mytable` (
the_time TIMESTAMP,
customer_name STRING,
item_name STRING,
price NUMERIC);
INSERT INTO `myproject.mydataset.mytable` (
the_time, customer_name, item_name, item_id, price)
'2019-08-01 12:41:11', 'John Smith' 'MacBook Pro', '1245124', 2000
SELECT * FROM `myproject.mydataset.mytable`;

superQuery detects from the syntax whether to execute these queries in parallel, or in a sequence.

To do so, write out your queries as you would in a Query Tab, separated by a semicolon. Then create your scheduled query as normal, except do not include a destination table when configuring the settings.

Scheduler Tips & Tricks

There are a couple unique characteristics about superQuery's scheduler. Notably, you can:

  • Schedule queries that Create, Update, and Delete other tables.

  • Set Job priority to Batch mode to help in cases when the scheduled query is triggered during high load times (when using Slots). BigQuery's engine will allocate resources at the best time.

  • Select the billing project the query will be executed on while defining another project inside your SQL.