Lineage and integration
Data contracts between producers and consumers: what to agree and how
Contents
Most data incidents are not bugs. Someone upstream changed something that someone downstream relied on: a column renamed, a new code value, a file delivered two hours later than usual. A data contract makes these dependencies explicit. The producer of a data set agrees with its consumers what they will receive, in what shape, of what quality, how often, and how changes will be handled.
In short
- A data contract is an agreement between the producer of a data set and its consumers about what the data is and what they can rely on.
- It covers the schema, the meaning of each field, quality expectations, service levels such as freshness and availability, access and use, and the rules for change.
- The producer owns the contract; consumers are known by name and purpose.
- Contracts work best when they are machine-readable and checked automatically before data is published.
- A breaking change needs notice, a new version and a period in which both versions run.
Why data contracts
Data moves between teams through interfaces: files, APIs, event streams, shared tables. Each producing team looks after its own system, and the consumers of its data depend on it silently. Without an explicit agreement:
- a change that is harmless for the producer breaks reports, models and processes downstream;
- nobody has said how fresh or how complete the data should be, so every delay becomes a dispute;
- quality problems are found by consumers, far from the place where they could be fixed;
- the producer does not know who uses the data, so nobody can be warned.
A data contract moves responsibility to where the data is created: the team that produces a data set answers for it, as a team that offers an API answers for its API. The idea is not new: interface specifications, service level agreements and API contracts have existed for a long time. Data contracts apply it to data sets, and they are a building block of data products in data mesh.
What a data contract contains
| Section | What it says | Example |
|---|---|---|
| Parties | The producer (its system and owning team), the consumers and the purpose of each | The order system’s team; finance reporting and demand planning |
| Description | What the data set represents, and at what granularity | One row per order line, from order entry onwards |
| Schema | Fields, data types, keys, required fields, allowed values | currency_, values from ISO 4217 |
| Meaning | The business definition of each field, with units and time zones | Amounts in the order currency, excluding tax; times in UTC |
| Quality | The rules and thresholds the producer checks before publishing | No duplicate order lines; under 0.1% unknown products |
| Service levels | Freshness, frequency, availability, volume, retention | Complete by 06:00 on business days; kept for 7 days |
| Delivery | How the data travels and where it is found | A daily file, an event topic, a table in the warehouse |
| Access and use | Classification, personal data, permitted uses | Contains personal data; use limited to the stated purposes |
| Change rules | Versioning, what counts as breaking, notice and deprecation | 30 days’ notice before a breaking change; both versions run for 60 days |
| Support | Contacts, the incident process, response times | The data steward and the team’s support channel |
| Status | Where the contract is in its life cycle | Draft, active, deprecated, retired |
The meaning of the fields matters as much as their types. Link each field to its term in the business glossary, so that “net amount” means the same in the contract as in every report built on it.
Breaking and non-breaking changes
| Change | Usually | Why |
|---|---|---|
| Adding an optional field | Not breaking | Existing consumers ignore what they do not read |
| Adding a value to a code list | Breaking for some | Consumers with fixed mappings reject or misclassify the new value |
| Removing or renaming a field | Breaking | Queries and loads fail |
| Changing a data type or length | Breaking | Loads fail, or values are truncated |
| Making a required field optional | Breaking | Consumers count on a value being there |
| Changing the meaning, unit or calculation | Breaking, and silent | Nothing fails, but every result changes |
| Delivering later or less often | Breaking for time-critical consumers | Jobs downstream run on incomplete data |
The most dangerous changes are the semantic ones: the schema stays the same, so no technical check fails. Only a contract that states the meaning of each field, and a habit of announcing changes to it, protects against them. For event streams, schema registries can enforce compatibility, accepting only new schema versions that remain readable for existing consumers.
Who does what
| Producer | Consumer |
|---|---|
| Owns the contract and keeps the data within it | Registers as a consumer and states the purpose |
| Checks the schema and the quality rules before publishing | Uses the data as described, not undocumented behaviour |
| Announces changes with the agreed notice, and versions them | Tests against a new version within the notice period |
| Reports incidents and fixes them at the source | Reports problems through the agreed channel |
Consumers do not write the contract for the producer. They can ask for guarantees, but only the producer can commit to them.
Introducing data contracts
- Start where it hurts. Begin with the interfaces behind critical reports and regulatory outputs, and those with many consumers.
- Write the contract where the producer works. A machine-readable file, in YAML or JSON, kept in version control next to the code that produces the data. Open standards have appeared for this, such as the Open Data Contract Standard (ODCS), maintained by the Bitol project of the Linux Foundation AI & Data.
- Check it automatically. Validate the schema and the quality rules in the producer’s pipeline before the data is published, and stop or quarantine a delivery that breaks the contract.
- Register it in the catalog. Connect the contract to the data lineage, the glossary and the list of consumers, so that it can be found and its impact assessed.
- Agree a change process: a proposal, an impact analysis through the lineage, notice to the consumers, a new version, a parallel run and the retirement of the old version.
- Review regularly. Retire contracts nobody uses any more, and keep the list of consumers current.
Data contracts and other agreements
| Agreement | Between | Covers |
|---|---|---|
| Data contract | The producer and the consumers of a data set | Schema, meaning, quality, service levels, change rules |
| API specification | An API provider and its clients | Endpoints, messages and errors, written for example in OpenAPI or AsyncAPI |
| Service level agreement | A service provider and its customers | Availability, support and response times |
| Data sharing agreement | Two organizations | Legal terms: purpose, permitted use, protection, liability |
| Data processing agreement | A controller and a processor under the GDPR (Article 28) | Processing personal data on behalf of the controller |
They complement each other. An interface with an outside party may need a data sharing agreement for the legal terms and a data contract for what is delivered and how.
Common mistakes
- Contracts that nobody checks. A document no pipeline validates becomes outdated with the first change.
- Schema without meaning. Field names and types say nothing about units, scope or calculation.
- Unknown consumers. A producer cannot give notice to teams it does not know about.
- Contracts written by consumers. Guarantees the producer never agreed to are wishes.
- No change process. Without notice and versions, a contract only describes the data until the next release.
- Everything at once. Contracts for hundreds of data sets at once become paperwork; start with the critical ones.
- Forgetting outside parties. Data received from or sent to other organizations needs contracts most.
Frequently asked questions
What is a data contract?
A data contract is an agreement between the producer of a data set and its consumers about what the data contains and what consumers can rely on: the schema, the meaning of each field, quality expectations, service levels such as freshness, permitted use, and how changes will be announced and versioned.
What should a data contract include?
The producer and consumers, a description of the data and its granularity, the schema, the business meaning of each field, quality rules and thresholds, service levels such as freshness, frequency and availability, delivery details, access and permitted use, change rules with a notice period, support contacts and the status of the contract.
Who owns a data contract?
The producer. The team that creates the data commits to what it delivers and keeps the data within the contract. Consumers register their use and purpose, and can ask for changes, but only the producer can make the commitments a contract contains.
What is the difference between a data contract and an SLA?
A service level agreement covers the availability and support of a service. A data contract covers the data itself: its structure, meaning and quality, as well as service levels such as freshness. A data contract often includes service levels, but an SLA alone says nothing about what the data means.
How do you handle breaking changes in a data contract?
Announce them with the notice period the contract promises, publish the change as a new version, run the old and the new version side by side long enough for every consumer to move, and retire the old version only after that. Use the lineage to find every consumer the change reaches.
Do we need a special tool for data contracts?
Not to start. A contract can begin as a structured file in version control, checked by tests in the producer’s pipeline. Tools help when there are many contracts: to validate them automatically, to register them in the data catalog and to connect them to lineage and impact analysis.