Data Contracts Between Producers & Consumers
Agree schema, SLAs, and ownership contracts so producers cannot silently break consumers.
In plain words
Fields, semantics, and SLO impact. Next, schema plus grain/meaning/quality/owner. Finally, compatibility window, deprecation, and major version.
Think of it like…
A data contract is a supplier specification plus service-level delivery note: shape, units, arrival schedule, quality tolerance, owner, and cancellation policy all travel with the goods.
Where you’ve seen it
orders.v3 promises order_id as tenant-unique, amount_minor integer currency units, one finalized event per version, <=15-minute freshness, and 30-day PII retention; CI rejects removing a required field before a major version.
Words you’ll hear
- Contracts
- Versioned producer/consumer agreements spanning structural, semantic, operational, and governance behavior.
- SLAs
- Measurable promises for freshness, availability, quality, latency, and recovery with a named owner.
- Ownership
- Accountability for publishing, incidents, migration, consumer communication, and eventual retirement.
- Operational boundary
- A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident. Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change.
Visual diagram
Theory & deep dive
Contracts: the working mechanism
A data contract is an explicit producer/consumer agreement covering schema, semantic grain, compatibility, SLO, ownership, quality, and security that is validated before and during production changes.
Fields, semantics, and SLO impact. Schema plus grain/meaning/quality/owner, then producer CI and runtime evidence; this exposes the state governed by Ownership.
orders.v3 promises order_id as tenant-unique, amount_minor integer currency units, one finalized event per version, <=15-minute freshness, and 30-day PII retention; CI rejects removing a required field before a major version.
Data Contracts Between Producers & Consumers: failure mode and production response
A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change. Track Major version as "breaking schema or semantic contract", and make Deprecation window visible to the dataset owner.
How it works, step by step
Step 1 of 41. Discover consumers
Fields, semantics, and SLO impact. A data contract is an explicit producer/consumer agreement covering schema, semantic grain, compatibility, SLO, ownership, quality, and security that is validated before and during production changes.
- Major version
- breaking schema or semantic contract
- SLAs
- Measurable promises for freshness, availability, quality, latency, and recovery with a named owner.
When to use it & trade-offs
What it is
A data contract is an explicit producer/consumer agreement covering schema, semantic grain, compatibility, SLO, ownership, quality, and security that is validated before and during production changes. orders.v3 promises order_id as tenant-unique, amount_minor integer currency units, one finalized event per version, <=15-minute freshness, and 30-day PII retention; CI rejects removing a required field before a major version.
Why it matters: A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident. Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change.
When to reach for it
- Agree schema, SLAs, and ownership contracts so producers cannot silently break consumers.
- Choose Contracts because it provides this capability: Versioned producer/consumer agreements spanning structural, semantic, operational, and governance behavior.
- Keep evidence for Major version at "breaking schema or semantic contract" so the last production stage-Evolve - compatibility window, deprecation, and major version-remains testable.
When to avoid or be careful
- A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
- Do not conflate SLAs with Contracts. The second concept contributes different behavior: Measurable promises for freshness, availability, quality, latency, and recovery with a named owner.
- Release only after this guardrail is in place: Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change.
Contracts / SLAs / Ownership - roles, limits, and operating cost
Strengths: Versioned producer/consumer agreements spanning structural, semantic, operational, and governance behavior. A data contract is an explicit producer/consumer agreement covering schema, semantic grain, compatibility, SLO, ownership, quality, and security that is validated before and during production changes.
Watch out: A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
Strengths: Measurable promises for freshness, availability, quality, latency, and recovery with a named owner. In this workflow it supports: Validate - producer CI and runtime evidence.
Watch out: The operating cost is real: longer than slowest consumer migration.
Strengths: Accountability for publishing, incidents, migration, consumer communication, and eventual retirement. Its output can be checked with Contract violations.
Watch out: Operating guardrail: Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change.
Interview signals & numbers to know
When this topic comes up
- “Where is the failure boundary for Contracts, and how would Major version reveal it?”
- “Why is SLAs distinct from this behavior: accountability for publishing, incidents, migration, consumer communication, and eventual retirement?”
- Production clue: A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
- Design probe: Version the contract beside producer code, validate compatibility in CI, publish runtime SLO/quality evidence, expose deprecation windows, and require producers to acknowledge consumer impact before a breaking field or grain change.
Benchmarks & rules of thumb
- Major version
- breaking schema or semantic contract
- Deprecation window
- longer than slowest consumer migration
- Contract violations
- CI and runtime failures by producer/version
Common mistakes & follow-ups
Common interview mistakes
- A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
- Reporting success from a job exit code without checking Major version and Deprecation window.
- Treating this example as complete without replay, rollback, or access boundaries:
orders.v3promisesorder_idas tenant-unique,amount_minorinteger currency units, one finalized event per version, <=15-minute freshness, and 30-day PII retention; CI rejects removing a required field before a major version.
Likely interviewer follow-ups
- How would you prove this contract instead of only checking that the command ran: Versioned producer/consumer agreements spanning structural, semantic, operational, and governance behavior.
- What does the recovery plan do when this occurs? A JSON schema alone misses a renamed region meaning, broken freshness, duplicate keys, or an ownerless table; enforcing contracts only at consumption shifts breakage to the downstream incident.
- When is Contracts insufficient for Deprecation window, and what does adding SLAs cost in Major version?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Data Contracts Between Producers & Consumers with data engineer interview Q&A and hands-on practice.