Docs
Docs /Scheduling /Scheduled queries
Scheduling

Scheduled queries

Run a query on a timetable and write its result to a table, using BigQuery's Data Transfer Service. Querylab.io fills in the schedule form; BigQuery runs the jobs, so they run without your browser open and outside the app's cost limits.

Scheduled Queries tab
Scheduled Queries
SchedulesRun History
NameDestinationScheduleStatus
1daily_user_analyticswarehouseevery day 06:00Succeeded
2hourly_eventswarehouseevery 1 hoursSucceeded
3dim_userswarehouseevery monday 09:00Disabled
4scheduled_testevery 1 hoursFailed
Every schedule in every billing project, across all BigQuery regions. A count (5 schedules) sits in the header next to the title.

Creating a schedule

Write the query in a tab, then open the editor’s ⋯ menu → Schedule Query. A SCHEDULE panel opens on the right; it stays open while you keep editing the SQL.

FieldNotes
Schedule NameShown in the list and in the BigQuery console
FrequencyHourly, Daily, Weekly, Monthly or Custom — see below
DatasetWhere the result table goes, chosen from the tab’s billing project
Table NameStatic, or templated: results_{run_date} gives one table per day; {run_time|"%Y%m%d"} for other formats
Write ModeAppend to table, Write if empty, or Overwrite table

Under Notifications: Email on failure, and Pub/Sub Topic (optional) (projects/…/topics/…) for wiring up your own alerts. Under Advanced: a service account to run as, start and end times for the schedule, labels (env=prod, team=analytics), partitioning type and field, and up to four clustering fields.

Click Create Schedule. The schedule is created in the tab’s billing project, in that project’s region (us if none is set).

Schedule strings

The Frequency picker builds the string BigQuery expects; Custom lets you type one directly.

FrequencyString sent
Hourly, every 2 hoursevery 2 hours
Daily at 06:00every day 06:00
Weekly, Monday 09:00every monday 09:00
Monthly, 1st at 00:00every 1 of month 00:00
CustomA cron line, e.g. 0 6 * * 1-5

Times are UTC. The panel’s Timezone dropdown only changes the preview underneath the picker; it isn’t sent with the schedule.

Runtime parameters

Two parameters are set by BigQuery on every run — the panel lists them under Available query parameters:

12345
SELECT make, COUNT(*) AS tests
FROM `ace-analytics.warehouse.mot_tests`
WHERE completed_date = @run_date
AND completed_at < @run_time
GROUP BY make

@run_date is the logical DATE of the run; @run_time the intended execution TIMESTAMP in UTC. Both are also what {run_date} and {run_time} in the table name expand from.

Granting the Data Transfer scope

Scheduling uses the Data Transfer API, which the normal BigQuery scope doesn’t cover. The first time you click Create Schedule without it, the panel says Additional permissions required. with a Grant Access button; that re-runs Google sign-in asking for the cloud-platform scope. See Authentication.

Other things that can stop a create:

  • Permission denied. You need the “BigQuery Data Transfer Service Agent” or “BigQuery Admin” role — an IAM problem in the project, fixed in the Google Cloud console.
  • In the desktop app with local credentials, Show Instructions replaces Grant Access: run gcloud auth application-default login, which grants cloud-platform by default.
  • Playground can’t create schedules.

App limits do not apply to scheduled queries: the per-tab byte limit and your budgets are enforced only for queries run from Querylab.io. A schedule runs inside BigQuery; set a custom quota there if you need a ceiling.

Managing schedules

KScheduled queries, or the top-right query-actions menu → Scheduled Queries, opens the list tab. It queries every project in your billing project list across all regions, so it can take a few seconds; click the N schedules count to refresh.

Filter by text, by Status (Succeeded, Failed, Running, Pending) and by Enabled. Each card shows the destination dataset, the schedule string and the next run, plus four buttons:

  • History selects the schedule and switches to the Run History tab, which lists every run with its status and time.
  • Run now triggers one run immediately.
  • Pause / Resume toggles Disabled without deleting anything.
  • Delete removes the schedule after a confirmation. Tables it already wrote are untouched.

To change a schedule, create a new one with the new settings and delete the old one; there is no edit button in the list yet.