Every Region Exports Its Own Way

A medium Pipeline Design interview practice problem on DataDriven. Design the pipeline on the canvas: sources, transforms, storage and checks, then get feedback on it.

Domain
Pipeline Design
Difficulty
medium
Seniority
L5

Problem

Design one pipeline to move transactional sales data from multiple regional databases into a centralized analytics layer on GCP, replacing the ad-hoc exports our regional teams run today. The five regions sit in different time zones and each adds a few million sales rows a day, with deals edited for weeks after they are created.

Sales data, BigQuery, Dataflow. Make it all sing.

Business requirements

Worked solution and explanation

What this really is

This is multi-tenant warehouse consolidation dressed up as an ingestion project. Anyone can draw regional databases flowing into a warehouse. The real test is whether three asks from three rooms survive one pipe: morning actuals per region, a smaller bill, and region isolation on deals. The trap is one nightly job that pulls every region into a flat table. The slowest region then sets everyone's deadline. Every dashboard scans the whole table, and region filtering lives in the BI tool, one forgotten clause away from a rep seeing another region's deals.

Step 1: Replace ad-hoc exports with one extraction path

Regional extraction reads each database's change log and publishes to the ingestion queue, keyed by region. Every region ships the same way, and a stalled region only grows its own backlog.

Step 2: Normalize and upsert in the transform

Beam maps each region's schema to one shape and upserts on deal_id. A redelivered message overwrites a row instead of doubling revenue.

Step 3: Schedule each region on its own clock

The orchestrator runs one task per region against that region's local deadline, so a late region blocks no one else. The global executive view refreshes once every region has landed.

Step 4: Partition by sale_date, cluster by region

A manager's 'last 7 days' query prunes to 7 partitions and, inside them, to one region's blocks. Bytes billed track the question asked, not the table size. That is the CFO answer.

Step 5: Enforce the region boundary on the table

A row access policy filters region by the caller's group, and finance gets a policy that grants every row. The dashboard, a notebook and a CSV export all return the same rows.

The reference design

Change events flow through a queue and a Beam transform into one warehouse partitioned by `sale_date` and clustered by `region`. The orchestrator lands each region-day on its own schedule, and the access policy scopes every read before the dashboard sees a row.
  • regional extraction (source, CDC)
  • ingestion queue (queue, Kafka)
  • regional transform (transform, Beam)
  • partitioned analytics warehouse (storage, warehouse)
  • per-region orchestrator (transform, Airflow)
  • region row access policy (quality gate, custom)
  • regional dashboard (consumer)
  • regional extraction -> ingestion queue
  • ingestion queue -> regional transform
  • regional transform -> partitioned analytics warehouse
  • per-region orchestrator -> partitioned analytics warehouse
  • partitioned analytics warehouse -> region row access policy
  • region row access policy -> regional dashboard
One nightly global job
Extracts every region in one run. One slow region delays everyone, and a rerun reloads the world, often appending duplicates.
Per-region close
Data arrives all day and each region closes on its own clock. A rerun overwrites one sale_date partition for one region.

Common follow-up questions