BigQuery scheduled jobs let you run SQL statements automatically on a fixed timetable, eliminating manual refreshes.
Automating reports, refreshes, and exports saves time and prevents missed updates. Scheduled queries run in Google Cloud, use service-account billing, and integrate with Stackdriver for alerts.
CREATE SCHEDULE wraps a normal SELECT, INSERT, or DML statement in a job definition.Options control frequency, windowing, destination tables, and alerting.
CREATE SCHEDULE my_project.my_dataset.daily_sales OPTIONS(schedule="every 24 hours") AS SELECT * FROM ...;
Key options: schedule
(cron/interval), time_zone
, destination_table_name_template
, write_disposition
, start_time
, end_time
, enabled
, and notification_pubsub_topic
.
Create a schedule that runs nightly, truncates the destination, and inserts aggregated sales totals into sales_summary
.
Use the BigQuery UI "Scheduled Queries" tab, the bq ls --transfer_config
CLI, or Cloud Monitoring metrics.Pause, resume, backfill, or delete schedules as needed.
Version-control SQL, parameterize dates with @run_date
, use UTC or a fixed time_zone, set write_disposition
explicitly, and send Pub/Sub alerts on failures.
Omitting write_disposition: default is APPEND, which bloats tables. Set WRITE_TRUNCATE or MERGE when you need fresh data.
Forgetting time_zone: schedules default to UTC. Specify your locale to avoid 24-hour drift.
Yes.In the UI choose "Backfill" or run bq mk --transfer_config --run-backfill
to re-run for past dates.
Absolutely. Any single SQL statement—including INSERT, MERGE, or CALL—can be wrapped in a schedule.
Edit the schedule and change the service account or update IAM roles; jobs start using the new credentials immediately.
.
Yes. Use the reserved @run_date
parameter to reference the job’s logical date and time within your SQL.
No. BigQuery runs schedules under a service account tied to the project; revoke or rotate it via IAM.
In the UI click "Pause" or run ALTER SCHEDULE ... SET OPTIONS(enabled=false);
. Resume later with enabled=true
.