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.
| Name⏷ | Destination⏷ | Schedule⏷ | Status⏷ | |
|---|---|---|---|---|
| 1 | daily_user_analytics | warehouse | every day 06:00 | Succeeded |
| 2 | hourly_events | warehouse | every 1 hours | Succeeded |
| 3 | dim_users | warehouse | every monday 09:00 | Disabled |
| 4 | scheduled_test | every 1 hours | Failed |
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.
| Field | Notes |
|---|---|
| Schedule Name | Shown in the list and in the BigQuery console |
| Frequency | Hourly, Daily, Weekly, Monthly or Custom — see below |
| Dataset | Where the result table goes, chosen from the tab’s billing project |
| Table Name | Static, or templated: results_{run_date} gives one table per day; {run_time|"%Y%m%d"} for other formats |
| Write Mode | Append 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.
| Frequency | String sent |
|---|---|
| Hourly, every 2 hours | every 2 hours |
| Daily at 06:00 | every day 06:00 |
| Weekly, Monday 09:00 | every monday 09:00 |
| Monthly, 1st at 00:00 | every 1 of month 00:00 |
| Custom | A 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:
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 grantscloud-platformby 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
⌘ K → Scheduled 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.