Domain 5 of 5 · Chapter 2 of 5

Automation & Repeatability

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing Professional Data Engineer premium course — no separate purchase.

Included in this chapter:

  • Idempotency: the rule that makes a rerun safe
  • Authoring a Composer DAG for recurring work
  • Choosing the scheduler for recurring work
  • Infrastructure as code for repeatable environments
  • Exam-pattern recognition

Choosing a scheduler/orchestrator for recurring data work

Recurring work shapeToolSchedule mechanismCoordinates downstream steps?
One SQL statement on a cadenceBigQuery scheduled queryCron-like, minimum 5 minutes between runsNo, single statement only
SQL models, dev-to-prod promotionDataform workflow configurationUnix-cron, runs a release config's actionsWithin the SQL graph, not across services
Many cross-service tasks, retries, backfillCloud Composer (Airflow) DAGschedule_interval plus catchup/backfillYes, full task dependency graph
Short chain of services or APIs, branchingWorkflowsTriggered, often by Cloud SchedulerYes, ordered steps with switch and retry
Fire one target on a timetableCloud SchedulerUnix-cron cron jobNo, it only triggers a single target

Decision tree

One SQL statementon a cadence?YesBigQueryscheduled queryNoSQL models, dev toprod promotion?YesDataformNoMany dependent tasksacross services?YesCloud Composer(Airflow DAG)NoShort chain of servicesor APIs, branching?YesWorkflowsNoCloud Schedulerfire one target

Cheat sheet

  • Make every recurring task idempotent so a rerun is safe
  • Overwrite the run's partition instead of appending to stay idempotent
  • Key the processing window off the logical date, not the wall clock
  • Pin a DAG's start_date to a fixed value
  • An operator describes the work; a task is an instance of it
  • Use a sensor to wait on data arriving, not a guessed time offset
  • Deploy a Composer DAG by dropping the .py into the /dags bucket folder
  • Catchup and backfill rerun missed intervals, but only safely if tasks are idempotent
  • Use a BigQuery scheduled query for a single recurring SQL statement
  • Schedule a SQL transformation graph with a Dataform workflow configuration
  • A Scheduler target may fire more than once, so make it idempotent
  • Define the data environment in Terraform so a second copy is one apply away
  • Keep Terraform state in a remote Cloud Storage backend, not on a laptop
  • Use Infrastructure Manager to let Google run your Terraform
  • Match the recurring scheduler to the shape of the work, lightest first
  • Order Terraform resources by referencing an output attribute, not depends_on
  • Manage BigQuery dataset IAM with google_bigquery_dataset_access to keep authorized views
  • Migrate Deployment Manager to Terraform with DM Convert, then run it in Infrastructure Manager
  • Schedule recurring batch Dataflow with a Dataflow data pipeline on Cloud Scheduler
  • Enable a Composer triggerer so deferrable operators free worker slots while waiting

Unlock with Premium — includes all practice exams and the complete study guide.

References

  1. https://cloud.google.com/composer/docs/composer-3/write-dags
  2. https://cloud.google.com/composer/docs/concepts/overview
  3. https://cloud.google.com/composer/docs/composer-3/manage-dags
  4. https://cloud.google.com/bigquery/docs/scheduling-queries
  5. https://cloud.google.com/dataform/docs/workflow-configurations
  6. https://cloud.google.com/workflows/docs/overview
  7. https://cloud.google.com/scheduler/docs/overview
  8. https://cloud.google.com/docs/terraform/terraform-overview
  9. https://cloud.google.com/infrastructure-manager/docs/overview