Prepare and test your skills
Prepare and test your skills
Cloud Composer (opens in a new tab), also called Managed Service for Apache Airflow, is a fully managed workflow orchestration service built on Apache Airflow. Cloud Composer is designed for extract, transform, load (ETL) and extract, load, transform (ELT) workloads that span multiple systems. Unlike simple time-based scheduling, it manages task order, dependencies, and retries for durable production data and MLOps workflows across BigQuery (opens in a new tab) and other Google Cloud and external systems.
A Directed Acyclic Graph (DAG) is a workflow definition that ensures each task runs at the right time and in the right order. The DAG defines dependencies between tasks, so a downstream task such as a BigQuery job runs only after the upstream tasks it depends on have finished. This dependency model lets one DAG sequence an end-to-end process, such as extracting data, triggering model training, and updating a dashboard.
Each task in a DAG is a single unit of work. A task can represent almost anything, including:
A DAG can start on a schedule, manually, or in response to an event such as a change in a Cloud Storage bucket. Cloud Composer therefore supports both time-driven and event-driven scheduling, which allows BigQuery jobs to run as part of larger workflows rather than only at fixed times.
A Managed Airflow environment is a self-contained Airflow deployment based on Google Kubernetes Engine (GKE) that runs workflows and all Airflow components. You can create one or more environments in a single Google Cloud project in any supported region, and each environment connects to other Google Cloud services through connectors built into Airflow. The environment provisions the compute, storage, and observability needed to process and execute DAGs.
Each environment includes four connected parts:
Data flows from the environment's bucket to the GKE cluster when workers read DAG files, and results flow back as logs to Cloud Logging and metrics to Cloud Monitoring. Because the database tracks state and the bucket holds definitions, the schedulers and workers can coordinate which task runs next across retries and scheduled runs.
Managing Cloud Composer involves two levels: managing the environment and managing the DAGs inside it. You can create and configure environments in the Google Cloud console, Google Cloud CLI, Cloud Composer API, or Terraform. You can add, update, remove, or trigger DAGs from the Google Cloud console, the native Airflow UI, or by running Google Cloud CLI and Airflow CLI commands.
Cloud Composer simplifies complex pipelines with reusable integrations and configuration. It provides a library of over 1,000 prebuilt operators for seamless integrations, which eliminates the need to build custom containers for non-ML tasks. It also supports Airflow connections, configuration options, custom plugins for in-house operators and sensors, Python dependencies from the Python Package Index or Artifact Registry, and a declarative YAML framework that lets data scientists build production-grade pipelines without deep Airflow expertise.
Exam tip: Simple scheduled queries are time-driven only and fit straightforward query chains with no external dependencies, while Cloud Composer is time-driven and event-driven and fits multi-step workflows with dependencies across systems.
Cloud Scheduler is a periodic trigger that starts BigQuery jobs on a timetable so data is delivered reliably without manual runs. In BigQuery (opens in a new tab), a scheduled query is managed by the BigQuery Data Transfer Service as a transfer configuration that runs a SQL query and writes the results to a destination table. The scheduler starts each run, BigQuery executes the query, and results flow from the query to the configured destination table.
Periodic execution in BigQuery means a saved query becomes a recurring transfer that runs on its schedule and writes to the same destination each time. The transfer configuration holds the query text, the schedule, the destination dataset and table, and the credentials used to run it. When the scheduled time arrives, the service runs the query with those stored credentials and applies the destination table write preference, either appending new rows or overwriting the table.
A job is typically created in an ordered workflow:
SELECT query, choose a destination dataset and table and select Append to table or Overwrite table.Because the destination, location, and identity are stored with the schedule, every run behaves the same way and downstream tables stay up to date.
A schedule in the transfer configuration defines how often the BigQuery job runs using a Cron-like time specification. The schedule controls the repeat interval, an optional start time that delays the first run until the next cycle, an optional end time, and an on-demand option that saves the query with no schedule. The minimum duration between scheduled queries is 5 minutes, so schedules cannot repeat more often than every 5 minutes.
Common custom schedule patterns include:
every mon 23:30 runs once per week on Monday evening.every 6 hours runs four times per day at evenly spaced intervals.every hour on mon,tue,wed,thu,fri runs hourly on weekdays only.If the specified start time is later than the time in the schedule, the first run waits for the next cycle. For example, a query created at 2022-06-05 23:50 with schedule daily 00:00 and start time 2022-06-06 10:00 will not run until 2022-06-07 00:00.
Exam tip: The minimum interval for a BigQuery scheduled query is 5 minutes — a schedule that repeats more often will not be allowed.
Failure handling for scheduled BigQuery jobs combines automatic retries with notifications that alert owners when a run fails. Temporary errors such as rateLimitExceeded or unavailable are recovered with exponential backoff and retry, where the client waits progressively longer between attempts and adds jitter to avoid retrying all at once. Official client libraries handle these gRPC retries automatically, for example during client.append_rows() calls, which provides protection without custom retry code.
The schedule also supports monitoring so repeated failures are not silent. The owner can enable Send email notifications for transfer run failures and can set a Pub/Sub topic, such as projects/myproject/topics/mytopic, to receive run status. Failed load jobs still count toward per-table and per-project quotas (opens in a new tab), and project quota refills over a rolling 24-hour period, so spreading operations across the day and using fewer, larger writes helps periodic jobs stay within limits.
BigQuery scheduled queries run a SQL query automatically on a defined schedule and save the results to a destination table. Scheduled queries in BigQuery (opens in a new tab) are managed by the BigQuery Data Transfer Service and are useful for recurring imports, daily rollups, and tasks that would otherwise require a separate data pipeline.
Scheduled queries automate repeated SQL work in BigQuery without manual runs or custom orchestration code. A scheduled query runs a GoogleSQL SELECT, DDL, or DML statement on a timetable and can write SELECT results to a destination table. Scheduled queries are also used to copy Bigtable (opens in a new tab) data accessed through an external table into BigQuery on a recurring basis.
Setting up a scheduled query creates a transfer configuration that defines the query text, schedule, destination, and credentials. In the Google Cloud console, the flow starts from a tested query using File > Schedule, while the bq command-line tool uses flags to make a query recurring.
To create a scheduled query in the console:
SELECT query, select Set a destination table for query results, choose the dataset name and table name, and choose Append to table or Overwrite table.The minimum time between scheduled query runs is 5 minutes. Custom schedules use Cron-like values such as every mon 23:30, every 6 hours, or every hour on mon,tue,wed,thu,fri. If the configured start time is later than the next scheduled time, the first run waits until the following cycle. The bq query command supports the same idea with --display_name, --destination_table or --target_dataset, and --schedule.
Exam tip: The minimum duration between scheduled queries is 5 minutes, and On-demand saves the query without a schedule so it can be run manually later.
Optimization for scheduled queries means scanning less data, writing efficiently, and avoiding quota and cost problems. Partitioned tables divide a large table into smaller segments by date, timestamp, or integer, so each scheduled run reads or writes only the needed partition. Partition limits apply at the partition level with a separate, higher limit for partition modifications, which greatly increases how many daily load and query jobs can run.
A common pattern is to collect the day's data in a staging table and then load it once into that day's partition, such as the partition for 2025-09-18. Avoid partitioning when partitions would stay consistently smaller than 10 GB. Other practices that help recurring queries run faster and cost less include:
INFORMATION_SCHEMA.JOBS views, or the jobs.get API to find stages that write unusually large output and add filters earlier.Monitoring a scheduled query means checking whether each transfer run succeeded, finding why it failed, and getting alerted automatically. BigQuery provides run history, job metadata, logs, and notification channels that work together for reliable operation.
Jobs Explorer lets operators search and inspect past and running jobs, including error messages, slot usage, timelines, and metadata without writing SQL. INFORMATION_SCHEMA.JOBS and INFORMATION_SCHEMA.JOBS_TIMELINE expose slot use, queue time, spilled bytes, and error codes for deeper analysis with SQL. Cloud Monitoring tracks slot usage, execution duration, and uploaded bytes and can alert when thresholds are crossed, while Cloud Audit Logs trace who started an operation and help diagnose permission errors. For scheduled queries specifically, email notifications report transfer-run failures and a Pub/Sub topic can receive a message for each run. Temporary failures such as rateLimitExceeded or unavailable are often handled by built-in exponential backoff and retry in the official client libraries, but repeated failures should be investigated through job history and error details.
BigQuery scheduled queries are time-driven only and fit straightforward query chains with no external dependencies, while Cloud Composer is time-driven and event-driven and fits multi-step workflows with dependencies across systems. Cloud Composer uses a Directed Acyclic Graph (DAG) so a downstream task such as a BigQuery job runs only after the upstream tasks it depends on have finished.
The minimum duration between BigQuery scheduled query runs is 5 minutes, so schedules cannot repeat more often than every 5 minutes. Custom schedules use Cron-like time specifications such as every mon 23:30, every 6 hours, or every hour on mon,tue,wed,thu,fri, and the On-demand option saves the query with no schedule so it can be run manually later.
A Cloud Composer environment includes a Google Kubernetes Engine (GKE) cluster that runs Airflow schedulers, triggerers, and workers, an Airflow web server that runs the Apache Airflow UI, an Airflow database that holds metadata about DAGs, tasks, and runs, and a Cloud Storage bucket that stores DAG files, logs, custom plugins, and environment data. Data flows from the bucket to the cluster when workers read DAG files, and results flow back as logs to Cloud Logging and metrics to Cloud Monitoring.
For a SELECT query, the transfer configuration writes results to the same destination dataset and table each time using either Append to table or Overwrite table. Temporary errors such as rateLimitExceeded or unavailable are recovered with exponential backoff and retry, and owners can enable email notifications for transfer run failures and set a Pub/Sub topic to receive run status.
A data analyst is setting up an automated workflow in BigQuery that executes a daily SQL aggregation query to refresh an executive reporting table. Before configuring the scheduled query, the analyst wants to validate the SQL syntax and estimate the number of bytes the query will scan to optimize performance and prevent unexpected billing, without executing the query or incurring on-demand query costs.
Which feature should the analyst use in BigQuery?
Run the query with batch priority
Create a slot reservation for the query
Configure a table expiration time on the destination table
Perform a query dry run
Last updated