Data quality · Contracts & Ops

What is a data contract?

Mediumdata contractproducersconsumersschemaSLA

Interview question

What is a data contract?

How to answer

The short answer

A is an explicit agreement between producers and consumers about a dataset's schema, semantics, freshness, and quality rules. It turns tribal knowledge into something you can enforce in CI and runtime.

A contract typically specifies

  • Schema and types
  • / grain
  • Nullability and enums
  • Ownership and support channel
  • Freshness / delivery
  • Compatibility policy for changes (additive vs breaking)
  • Quality checks that must pass before publish
Output
Producer: checkout service
  publishes orders.v1 under contract
Consumer: warehouse / dbt team
  builds fct_orders assuming contract holds

Why platforms adopt contracts

App teams rename userId → user_id or change amount units. Without contracts, every dashboard breaks overnight and DE teams firefight downstream.

Shift-left idea

Validate producer changes in CI (schema registry, contract tests) instead of only discovering breakage in the warehouse.

Interview tip: "Contract = enforceable producer-consumer agreement on schema, grain, freshness, and semantics." Mention CI checks and ownership.