Quick revision
The short answer
Data leaves each service through change data capture or published domain events, never through analysts querying service databases. It lands unchanged in an immutable raw area with its schema and metadata such as source, time and version. It is transformed by version-controlled SQL models, for example with dbt, that are tested for uniqueness, nulls and referential integrity. A data contract between each producing team and the data platform, checked in CI, protects the schemas, and freshness and volume monitoring with a named owner per source catches breakage early.
What to remember
In this answer, we designed a standard pipeline for 50 services. Data leaves through CDC or domain events instead of direct database queries, lands in an immutable, append-only raw area with uniform metadata, and is transformed by version-controlled SQL models with tests for uniqueness, nulls and relationships. Data contracts checked in each service's CI keep schema changes from breaking the warehouse, and freshness and volume monitoring with a named owner per source catches the rest quickly.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Data leaves each service through change data capture or published domain events, never through analysts querying service databases. It lands unchanged in an immutable raw area with its schema and metadata such as source, time and version. It is transformed by version-controlled SQL models, for example with dbt, that are tested for uniqueness, nulls and referential integrity. A data contract between each producing team and the data platform, checked in CI, protects the schemas, and freshness and volume monitoring with a named owner per source catches breakage early.
Why this question is asked
With 50 services, a warehouse fed by ad-hoc scripts turns into a maze: each service exported differently, schema changes break reports overnight, and nobody knows who to call when a table is stale. A standard turns the pipeline into something every team can join the same way and the data platform can operate. Interviewers ask this design question to see whether we can cover the whole path, from the service's database to a tested model, and the agreements between teams that keep it stable. In this answer, we will go through the four stages, how data leaves, lands, is transformed and is tested, and then the contracts and monitoring that hold it together.
1The Whole Path at a Glance
It helps to see the path as layers, each owned by someone and each with one job. Services own their data and how it is published. The data platform owns the transport, the raw landing area and the tooling. Analytics engineers, in the platform team or in domains, own the models built on top.
- Service database and outboxowned by the service team
- CDC or domain events on KafkaDebezium, schemas in a registry
- Raw landing areaimmutable, append-only, with metadata
- Staging modelsrename, cast, deduplicate per source
- Marts: facts and dimensionsbusiness logic, conformed dimensions
- BI tools and metrics layercertified definitions
6 layers, from the top down. Step through them one at a time.
Every one of the 50 services follows the same path, so a new service joining is configuration, not a project, and the platform team can operate one pipeline design instead of 50.
2How Data Leaves the Services
The first rule of the standard is that nobody outside the team queries a service's database directly. Direct queries put unpredictable load on production, bypass access control, and tie analytics to tables the team may refactor at any time.
Instead, services publish data in one of two approved ways. The first is log-based change data capture: Debezium reads the database's transaction log and writes every insert, update and delete to Kafka, which captures complete data with little effort from the team. The second is domain events, such as OrderPlaced or RefundIssued, written through a transactional outbox, which give stable, meaningful records that do not change when the internal schema does. The standard says which tables or events a service publishes, and for CDC it says the tables are part of a contract, so they cannot be renamed casually.
3How Data Lands: an Immutable Raw Area
A loader, for example a Kafka Connect sink or the warehouse's streaming ingestion, writes everything into a raw area exactly as received. Raw data is never updated or deleted by transformations; it is append-only. That gives us the ability to rebuild any model from scratch when logic changes, and to investigate what a service actually sent on a given day.
Each record carries metadata alongside its payload. The landing schema is the same for every source, so tools and monitoring work across all 50.
Partitioning raw tables by _loaded_at date keeps them cheap to scan incrementally, and retention rules on raw data, for example deleting personal data after the agreed period, are applied centrally rather than per model.
4How Data Is Transformed and Tested
Transformations are SQL models in one Git repository, managed with dbt or a similar tool. Staging models do the dull, per-source work: pick the latest version of each row from the CDC history, rename columns, cast types, and drop deleted rows. Mart models build facts and conformed dimensions, such as one dim_customer shared by every service's facts. Every change is a pull request with review and a CI run that builds the changed models against a sample.
Tests are part of the standard, not an option. Each model declares at least its primary key as unique and not null, foreign keys as relationships to their dimensions, and allowed values for status columns.
A failing test stops the downstream models from publishing, so a broken source shows up as a clear failure with the source's name instead of quietly wrong dashboards.
5Data Contracts and Schema Checks in CI
The weakest point of any such pipeline is the moment a service team changes its schema. A data contract is a written, versioned agreement for each published table or event: its fields and types, which fields are guaranteed, its meaning, its expected freshness and volume, and its owner. The contract lives in the service's repository, next to the code that produces the data.
The service's CI pipeline checks every change against the contract and against the schema registry's compatibility rules. Adding an optional field passes. Removing a field, renaming a column or changing a type fails the build, unless the team bumps the contract version and the platform agrees a migration, for example publishing both versions for a period. This moves breakage from the warehouse at 3 a.m. to the pull request where the change is made.
- Developer changes a published table
- CI compares with the contract and registrycompatibility BACKWARD
- Compatible change?YesMerge and deployNoBuild fails: bump contract version
- Platform agrees migrationboth versions published for a period
- Consumers move, old version retired
5 steps in order. Play them, or step through them one at a time.
6Monitoring: Freshness, Volume and Owners
Finally, every source has a named owning team in the service catalog and two basic monitors. Freshness checks the newest _source_ts against the contract, for example orders must be no older than 30 minutes. Volume checks that the number of rows per hour is within an expected range compared with the same hour last week, which catches a source that silently stopped sending deletes or doubled its events. Alerts go to the owner of the source and to the data platform on-call, with the source's name, so the right team acts quickly.
We also publish a simple dashboard of the 50 sources with their freshness, test status and contract version, which makes the health of the whole pipeline visible to everyone.
7Follow-up questions
Should every service use CDC or events?
Both are allowed, chosen per dataset. CDC is complete and cheap to start, which suits analytics on internal tables when the team accepts a contract on them. Events suit data with clear business meaning and many consumers. A common standard is events for core business facts and CDC for the rest.
Who writes the staging models, the service team or the data team?
Usually the data platform or a domain analytics engineer, with the service team reviewing, because staging needs knowledge of both the source and the warehouse conventions. In a data mesh setup, domain teams take this on themselves using the platform's templates.
How do you handle personal data in the raw area?
The contract marks personal fields. They are either excluded at the source, masked during landing, or stored in restricted raw tables with access control and retention rules, and models expose only what consumers need.
8Conclusion
In this answer, we designed a standard pipeline for 50 services. Data leaves through CDC or domain events instead of direct database queries, lands in an immutable, append-only raw area with uniform metadata, and is transformed by version-controlled SQL models with tests for uniqueness, nulls and relationships. Data contracts checked in each service's CI keep schema changes from breaking the warehouse, and freshness and volume monitoring with a named owner per source catches the rest quickly.
Open with
I'd make the path the same for every service, in four parts. First, how data leaves: no one queries service databases directly. Each service publishes either through log-based CDC with Debezium into Kafka, or through domain events written with a transactional outbox, and the published tables or events are declared.
Then, if they want more
Second, how it lands: a loader writes everything unchanged into an append-only raw area, with uniform metadata such as source, table, operation, schema version, source commit time and load time. Raw is never modified, so we can always rebuild models.
Third, transformation: SQL models in one Git repository with dbt, staging models per source for deduplication and typing, then marts with conformed dimensions. Every model has tests, primary keys unique and not null, relationships to dimensions, accepted values, and a failing test stops publication.
Fourth, the agreements: each published dataset has a data contract in the service's repo with fields, meaning, freshness and owner, and the service's CI checks changes against the contract and the schema registry, so a breaking change fails the build instead of the warehouse.
On top, I'd monitor freshness and volume per source, with alerts to the named owner, and a simple health dashboard for all 50 sources.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Design the data pipeline standard for 50 services that feed one warehouse: how data...": https://scrivio-interview-library.netlify.app/databases/analytics-and-cdc/128c447298/