Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is a data contract?

Data quality · Contracts & Ops

What is a data contract?

Mediumquality-11
data contractproducersconsumersschemaSLA

Question

What is a data contract?

Solution

A data contract 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
  • Primary key / grain
  • Nullability and enums
  • Ownership and support channel
  • Freshness / delivery SLA
  • Compatibility policy for changes (additive vs breaking)
  • Quality checks that must pass before publish
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.

PreviousNext