Video in progress

The analytics team wants to pull the data of all services into the DWH. How do you organize this without turning the services' internal schemas into a contract and without slowing them down?

I don't connect analytics straight to service DBs: that turns the internal schema into a hidden contract. Each service provides analytical data under a published data contract, through business events or a CDC stream controlled by the owner, with a schema registry, and ownership stays with the service team.

📖 Answer

The quick way, connecting an ETL tool to every service's DB, works at the start. A year later:

  • the order-service team renamed a column, and the next day the finance report showed a wrong number;
  • the nightly ETL slows down the prod DB with big SELECTs;
  • the team can't freely refactor its own tables, because it doesn't know who is reading them.

That is the shared database anti-pattern coming back in through the analytics door.

Options:

  1. Business events. Services already emit events like OrderPlaced and PaymentCompleted to Kafka. Through a sink connector (Kafka Connect → S3/Iceberg, BigQuery, ClickHouse) they reach the data platform. The good side is that the contract is published and versioned. But an event may not carry all the fields analytics needs.

  2. CDC (Debezium), the full stream of table changes. It is complete and low-latency, but it again exposes the internal schema. So rather than raw CDC, I deliver through an "analytics view" owned by the service team (a separate table similar to an outbox, or a transformation).

  3. A data contract. Whichever road you take, the service team publishes: which fields, what they mean, quality guarantees (never null, delay under 15 minutes), PII markers, schema evolution rules. If a schema change breaks the contract, the PR is stopped in CI, just like with an API.

The organizational side matters more. The useful core of the "data mesh" idea is this: data is a product, and its owner is the domain team. The central data team provides the platform (streams, storage, catalog), but it doesn't know the meaning of each service's data well.

Practical rules:

  • PII goes to analytics only when needed and in pseudonymized form;
  • every dataset has an owner and an SLA in the catalog;
  • analytical queries don't go to the prod OLTP database; a replica is only a temporary fix.

The measure of success: can a service team change its internal schema without breaking analytics? If yes, the boundary is right.