/

Data

Data contracts: how to stop upstream changes from breaking the data you depend on

Data contracts: how to stop upstream changes from breaking the data you depend on

Data

Data

Alveena Ali

Alveena Ali

Editor, Dataring

Editor, Dataring

Guide cover: Data contracts, agreed before shipping. A producer sends a change through a versioned contract to three consumers, and a breaking change is rejected.

On Tuesday, an engineer on the app team renames a column in the orders database so the code reads more clearly. On Wednesday morning, the revenue dashboard shows zero sales from new customers. The rename was reviewed, tested and correct for the app. Nobody on the app team knew a pipeline read that column, and nothing in their process could have told them.

Data contracts exist to close that gap. A data contract is a written, versioned agreement between the team that produces a dataset and the teams that use it, covering the structure of the data, what each field means, the quality it will meet and how changes will be handled. Stored as code and checked automatically, it turns a silent break on Wednesday into a failed check on Tuesday, before the change ships.

This guide covers data contracts from start to finish. It explains what a contract is and where the idea came from, why upstream changes keep breaking data, what goes in a contract, which data needs one, how to write the first one, how to enforce it in CI, in streams and in the warehouse, how to handle change without breaking consumers, who owns what and a 60-day plan for a small team. It includes a full contract example, enforcement code, templates and a worked example.

The short answer

Start with the datasets the business depends on most that cross a team boundary, such as orders from the app database feeding finance. For each one, bring the producing team and the main consumers together and write a contract that covers the schema, the meaning of each field, quality rules, freshness and other service levels, and named owners. Store it in a repository next to the producer’s code. Check every proposed change against it in CI, so a breaking change fails before it ships, and test the live data against it on a schedule. Version the contract, keep non-breaking changes cheap, and handle breaking changes by publishing a new version alongside the old one until consumers have moved.

Book a free call if you want help setting this up for the data your business depends on.

Key terms

  • Data contract: a machine-readable agreement that describes a dataset’s structure, meaning, quality and service levels, and how it will change.

  • Producer: the team whose system creates the data, such as the team that owns the app or the billing platform.

  • Consumer: any team or system that reads the data, such as analytics, finance, a model or another application.

  • Schema: the structure of the data, meaning the fields, their types and which are required.

  • Breaking change: a change that can make existing consumers fail or give wrong answers, such as removing a field, renaming it or changing its type or meaning.

  • Backward compatible: consumers using the new version can still read data written under the old one.

  • Forward compatible: consumers still on the old version can read data written under the new one.

  • Enforcement: automated checks that test changes and live data against the contract and act when they do not match.

The method at a glance

  1. Pick a Tier 1 dataset that crosses a team boundary.

  2. Bring the producer and the main consumers together.

  3. Write the schema, field meanings and quality rules.

  4. Agree service levels, owners and a support channel.

  5. Store the contract as code next to the producer’s code.

  6. Check every change against it in CI before it ships.

  7. Test the live data against it on a schedule.

  8. Version every change, and run breaking changes side by side.

A change moves left to right from the app team, through the contract in the repository and a CI check, into the warehouse and on to finance and analytics. A rename that breaks the contract is then stopped at the CI check before it ships.

What is a data contract?

A data contract describes what a dataset contains and what its producer promises about it. It borrows from how software teams treat APIs. An API has a published interface, versions and rules about what may change without warning. A data contract gives a table, a file or an event stream the same treatment, so the people who depend on it know what they can rely on.

A November 2026 article on martinfowler.com by Simon Harrer and Arif Wider sets out the properties a useful contract needs. It should be machine-readable, verifiable and versioned, published by the producer, who owns the promises, and written for consumers deciding whether the data fits their purpose. That list is a good test for any contract. A wiki page describing a table fails it, because no tool can check the data against a wiki page.

The idea spread through data engineering in the early 2020s, as more data came from application databases and event streams owned by teams outside the data function. Andrew Jones’s 2023 book Driving Data Quality with Data Contracts frames contracts as the interface between those who generate data and those who consume it, and puts responsibility for the data with the people who generate it, because they understand it best.

The open standard

There is now an open format for writing contracts. The Open Data Contract Standard, or ODCS, defines a YAML structure for a contract. It is maintained by Bitol, a project created in November 2023 by the AIDA User Group and the Linux Foundation AI & Data, which began from a template first used at PayPal. Bitol is now a graduated Linux Foundation AI & Data project under the Apache 2.0 license. Using a standard format means contracts can be read by any tool that supports it, and moving between tools does not mean rewriting them.

What a data contract is not

A contract is more than a schema. A schema says a column is a number. A contract also says it is an amount in US dollars including tax, that it is never null for paid orders, that the table is updated within an hour and that the payments team answers questions about it. A contract also differs from a legal agreement. It is a working document between teams, kept in version control and changed through review.

Why do upstream changes keep breaking data?

Most of the data a business analyzes is a side effect of software built for another purpose. The orders table exists so the app can process orders. Finance reading it for revenue is a second use the app team may never have been told about. When they change the table to improve the app, they are doing their job well, and the break lands somewhere they cannot see.

Several patterns cause most of these breaks:

  • Renames and removals. A column is renamed for clarity or removed because the app no longer uses it, and a pipeline that read it starts loading nulls.

  • Type changes. An integer becomes a string, or a timestamp moves to a different time zone, and joins and calculations quietly change.

  • Meaning changes. The column keeps its name and type, and its meaning shifts. An amount that excluded tax starts including it, or a status gains a new value that downstream filters drop.

  • Volume and timing changes. A batch job moves to a different hour, or a backfill sends a year of history at once.

The meaning changes do the most damage, because nothing fails. Every test that checks types and nulls still passes, and the numbers are wrong. Finding the cause usually means walking back through the pipeline until someone spots the change, which is why data lineage matters so much in an incident. A contract moves that discovery from the morning after to the moment the change is proposed.

What goes in a data contract?

A contract has a handful of parts. The current version of ODCS splits them into named sections for fundamentals, schema, data quality, support channels, team, roles, service levels, servers and others. A small team does not need all of them on day one. The parts below cover what most consumers need.

Fundamentals

The contract’s name, ID, version and status, such as draft, active, deprecated or retired, along with the domain it belongs to and a short description of the dataset. The status matters more than it looks. It tells consumers whether they can build on a dataset, and gives a clear way to retire one.

Schema

Every field, its type, whether it is required and whether it is part of the key. This is the part tools check most easily, and it catches renames, removals and type changes.

Meaning

A plain description of each field, including units, currency, time zone and how it is calculated. This is the part most often skipped, and the part that prevents the expensive errors. Write it for someone who has never seen the source system.

Quality rules

The checks the data will pass, such as a key that is unique, an amount that is never negative, a status from an agreed list or a row count within a range. These are the same checks covered in the guide to data quality management. In a contract, they become promises the producer makes and tests every day.

Service levels

How fresh the data will be, how often it updates, how long it is kept and how quickly problems will be answered. Freshness is the most common one. How to set data freshness SLAs covers how to choose targets.

Owners and support

The team that owns the dataset, named people in key roles and the channel consumers use to raise problems or request changes. Without this, a contract tells consumers what to expect and leaves them nowhere to go when it is not met.

Access and security

Who may read the data, which fields are personal or sensitive and any limits on how it may be used. Many teams start without this section and add it once access requests start arriving.

An example contract

Here is a contract for an orders table in the ODCS format. It covers fundamentals, schema with meanings, quality rules, freshness and owners:

apiVersion: v3.2.0
kind: DataContract
id: orders
name: Orders
version: 1.2.0
status: active
domain: commerce
description:
  purpose: One row per customer order placed in the web and mobile app.

schema:
  - name: orders
    physicalType: table
    quality:
      - type: sql
        description: At least one order per day
        query: select count(*) from orders where created_at >= current_date - 1
        mustBeGreaterThan: 0
    properties:
      - name: order_id
        logicalType: string
        required: true
        unique: true
        primaryKey: true
        description: Order identifier from the app. Never reused.
      - name: customer_id
        logicalType: string
        required: true
        description: Customer who placed the order.
      - name: amount_usd
        logicalType: number
        required: true
        description: >
          Order total in US dollars, after discounts and before tax.
          Refunds are recorded separately and are not netted here.
        quality:
          - type: sql
            description: No negative amounts
            query: select count(*) from orders where amount_usd < 0
            mustBe: 0
      - name: status
        logicalType: string
        required: true
        description: One of placed, paid, shipped, cancelled.
      - name: created_at
        logicalType: timestamp
        required: true
        description: When the order was placed, in UTC.

slaProperties:
  - property: freshness
    value: 1
    unit: hours
    element: orders.created_at

team:
  name: checkout-team
  members:
    - username: priya
      role: owner

support:
  - channel: "#orders-data"
    tool

apiVersion: v3.2.0
kind: DataContract
id: orders
name: Orders
version: 1.2.0
status: active
domain: commerce
description:
  purpose: One row per customer order placed in the web and mobile app.

schema:
  - name: orders
    physicalType: table
    quality:
      - type: sql
        description: At least one order per day
        query: select count(*) from orders where created_at >= current_date - 1
        mustBeGreaterThan: 0
    properties:
      - name: order_id
        logicalType: string
        required: true
        unique: true
        primaryKey: true
        description: Order identifier from the app. Never reused.
      - name: customer_id
        logicalType: string
        required: true
        description: Customer who placed the order.
      - name: amount_usd
        logicalType: number
        required: true
        description: >
          Order total in US dollars, after discounts and before tax.
          Refunds are recorded separately and are not netted here.
        quality:
          - type: sql
            description: No negative amounts
            query: select count(*) from orders where amount_usd < 0
            mustBe: 0
      - name: status
        logicalType: string
        required: true
        description: One of placed, paid, shipped, cancelled.
      - name: created_at
        logicalType: timestamp
        required: true
        description: When the order was placed, in UTC.

slaProperties:
  - property: freshness
    value: 1
    unit: hours
    element: orders.created_at

team:
  name: checkout-team
  members:
    - username: priya
      role: owner

support:
  - channel: "#orders-data"
    tool

apiVersion: v3.2.0
kind: DataContract
id: orders
name: Orders
version: 1.2.0
status: active
domain: commerce
description:
  purpose: One row per customer order placed in the web and mobile app.

schema:
  - name: orders
    physicalType: table
    quality:
      - type: sql
        description: At least one order per day
        query: select count(*) from orders where created_at >= current_date - 1
        mustBeGreaterThan: 0
    properties:
      - name: order_id
        logicalType: string
        required: true
        unique: true
        primaryKey: true
        description: Order identifier from the app. Never reused.
      - name: customer_id
        logicalType: string
        required: true
        description: Customer who placed the order.
      - name: amount_usd
        logicalType: number
        required: true
        description: >
          Order total in US dollars, after discounts and before tax.
          Refunds are recorded separately and are not netted here.
        quality:
          - type: sql
            description: No negative amounts
            query: select count(*) from orders where amount_usd < 0
            mustBe: 0
      - name: status
        logicalType: string
        required: true
        description: One of placed, paid, shipped, cancelled.
      - name: created_at
        logicalType: timestamp
        required: true
        description: When the order was placed, in UTC.

slaProperties:
  - property: freshness
    value: 1
    unit: hours
    element: orders.created_at

team:
  name: checkout-team
  members:
    - username: priya
      role: owner

support:
  - channel: "#orders-data"
    tool

Field names in the standard change between versions, so check the current ODCS documentation before you copy this. The structure matters more than the exact keys.

Rules worth including for common datasets

The right rules depend on the data. These are common starting points for the datasets that most often get contracts first.

  • Orders: a unique order ID, a customer ID on every order, amounts that are never negative, a status from an agreed list, the currency stated, the time zone of every timestamp stated and at least one order per day on a normal trading day.

  • Payments: a unique payment ID, every payment linked to an order or invoice, amounts that match the linked order within an agreed tolerance, a status from an agreed list and a daily total that reconciles with the payment provider’s report.

  • Customers: a unique customer ID that is never reused, a created date on every record, country codes from a standard list, and personal fields marked as sensitive with the access rules that apply.

  • Product events: a unique event ID, an event name from a published list, a timestamp in UTC, a user or session ID on every event, and a rule that new event names are added to the list before they are sent.

  • Invoices: a unique invoice number, an invoice total equal to the sum of its lines, a tax amount that is present when required, and dates that fall in an open accounting period.

  • Partner files: the expected file name pattern, the delivery time, the column list and types, a row count within the normal range and a control total that matches the partner’s summary.

Each rule should come from a consumer who depends on it. A rule nobody relies on adds work and no protection, so leave it out until someone needs it.

Where contracts sit next to other tools

Teams sometimes ask whether they need a contract when they already have tests, a catalog and a schema registry. Each covers part of the job. Tests check data after it arrives and are usually written by the consumer. A catalog describes data so people can find it, and is usually maintained after the fact. A schema registry checks structure for event streams. A contract is the agreement that ties them together, written before the data changes and owned by the producer. Many teams generate tests, catalog entries and registry settings from the contract, so the agreement only has to be written once.

Which data needs a contract?

Contracts take effort to write and to keep, so put them where they earn it. Two questions decide it.

  • Does the data cross a team boundary? A contract is an agreement between teams. Data produced and used by the same team can be protected with tests alone.

  • Does the business depend on it? Start with Tier 1 data, meaning data behind billing, payments, financial reporting, regulatory filings, customer-facing products and anything sent outside the company. How to decide which datasets your business depends on explains how to find it.

Where both answers are yes, a contract is usually worth it. Common first candidates are the orders, payments and customer tables copied from application databases, events from the product used for revenue or billing, and files from external partners that feed finance.

Where a dataset has no consumers at all, the right move may be to stop producing it. How to find and retire unused data pipelines covers how to check.

How do you write your first contract?

The first contract is mostly a conversation. The tooling is the easy part.

Start from what consumers actually use

List the fields consumers read, using the warehouse’s query history and the code of downstream models. Most tables have many more columns than anyone reads. A contract that covers only the fields in use is shorter to write, easier to agree and leaves the producer free to change everything else.

Get the producer and consumers in one meeting

An hour with the producing team and the two or three most important consumers is usually enough for a first draft. Walk through each field and ask what it means, what values it can take and what the consumers assume about it. This is where meaning changes get caught before they happen, because the producer often learns for the first time how a field is being used.

Write the rules together

Turn each assumption into a rule. If finance assumes amounts are never negative, write it down and add a check. If analytics assumes there is at least one order every day, add a row-count rule. Rules the producer has agreed to are rules they will test before shipping.

Agree service levels you can meet

Set freshness and support targets the producer can meet on a normal week. A promise of hourly updates that is missed every Monday does more harm than an honest promise of daily ones.

Name the owners

Every contract needs a named owning team, a person who approves changes and a support channel. How to assign data ownership covers how to find the right people.

Store it where changes happen

Put the contract in the producer’s repository, next to the code that creates the data. A change to the data and a change to the contract then go through the same review. A contract kept in a separate place tends to drift away from the data it describes.

How do you enforce a contract?

A contract that nothing checks is documentation. Enforcement happens at three points, and most teams need at least two of them.

In CI, before a change ships

The strongest check runs when a producer proposes a change. The Fowler article recommends treating contracts like APIs: lint the contract on every commit, detect breaking changes against the previous version in pull requests, and test data against the contract in each environment before deploying. The open-source Data Contract CLI supports these steps with commands such as lint, breaking and test. A CI job for a pull request might look like this:

# .github/workflows/data-contract.yml
name: data-contract
on: pull_request
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: pip install datacontract-cli
      - name: Lint the contract
        run: datacontract lint contracts/orders.yaml
      - name: Block breaking changes
        run: |
          git show origin/main:contracts/orders.yaml > /tmp/orders-main.yaml
          datacontract breaking /tmp/orders-main.yaml contracts/orders.yaml
# .github/workflows/data-contract.yml
name: data-contract
on: pull_request
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: pip install datacontract-cli
      - name: Lint the contract
        run: datacontract lint contracts/orders.yaml
      - name: Block breaking changes
        run: |
          git show origin/main:contracts/orders.yaml > /tmp/orders-main.yaml
          datacontract breaking /tmp/orders-main.yaml contracts/orders.yaml
# .github/workflows/data-contract.yml
name: data-contract
on: pull_request
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: pip install datacontract-cli
      - name: Lint the contract
        run: datacontract lint contracts/orders.yaml
      - name: Block breaking changes
        run: |
          git show origin/main:contracts/orders.yaml > /tmp/orders-main.yaml
          datacontract breaking /tmp/orders-main.yaml contracts/orders.yaml

Check the tool’s documentation for the current command options before you use this. The point is the shape: the pull request that renames a field fails, with a message that names the contract and the consumers it would break, and the conversation happens before anything ships.

At the stream

For data sent as events, a schema registry can enforce the schema part of a contract at the moment a producer registers a new version. Confluent’s Schema Registry checks every new schema version against earlier ones and rejects versions that break the configured compatibility type. Its default type is BACKWARD, which lets consumers on the new schema read data written under the old one.

Be careful with that default. Backward compatibility allows a producer to delete fields, and a consumer that still reads a deleted field will break. The Fowler article warns about exactly this and suggests forward compatibility for minor versions of event streams. For a Tier 1 stream, a stricter setting that checks against all earlier versions is safer:

curl -X PUT \
  -H "Content-Type: application/vnd.schemaregistry.v1+json" \
  --data '{"compatibility": "FULL_TRANSITIVE"}'

curl -X PUT \
  -H "Content-Type: application/vnd.schemaregistry.v1+json" \
  --data '{"compatibility": "FULL_TRANSITIVE"}'

curl -X PUT \
  -H "Content-Type: application/vnd.schemaregistry.v1+json" \
  --data '{"compatibility": "FULL_TRANSITIVE"}'

Full compatibility allows only optional fields to be added or removed. It is strict, and it is the setting that best matches the promise a contract makes.

In the warehouse

For tables built in the warehouse with dbt, model contracts enforce the schema of a model. With a contract enforced, every column must be listed with its name and data type, and dbt runs a preflight check before building the model. If the query returns different columns or types, the model fails to build:

models:
  - name: fct_orders
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: string
        constraints:
          - type: not_null
      - name: customer_id
        data_type: string
      - name: amount_usd
        data_type: numeric
      - name: status
        data_type: string
      - name: created_at
        data_type

models:
  - name: fct_orders
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: string
        constraints:
          - type: not_null
      - name: customer_id
        data_type: string
      - name: amount_usd
        data_type: numeric
      - name: status
        data_type: string
      - name: created_at
        data_type

models:
  - name: fct_orders
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: string
        constraints:
          - type: not_null
      - name: customer_id
        data_type: string
      - name: amount_usd
        data_type: numeric
      - name: status
        data_type: string
      - name: created_at
        data_type

dbt also looks for breaking changes when comparing a project with a previous state, such as a removed column or a changed data type, and versioned models raise an error. Model contracts cover structure only. Pair them with tests for the quality rules, and with dbt build so a failed test stops everything downstream.

Testing the live data

CI checks catch changes to code. They do not catch a bad day in production, such as a partial load or a source system that starts sending odd values. Run the contract’s quality rules against the live data on a schedule, and send failures to both the producer and the consumers named in the contract.

Block or warn?

Block a change in CI when it would break a Tier 1 contract, such as removing or renaming a field consumers read, or changing its type. Warn when a change is allowed and worth knowing about, such as a new optional field. Blocking too much makes producers work around the contract, and warning on everything teaches people to ignore it.

How should contracts handle change?

A contract is meant to make change safe. Data has to change as the business does, and a contract that freezes it will be abandoned.

Version every change

Most teams use semantic versioning. A major version is a breaking change, such as removing or renaming a field. A minor version is a change consumers can ignore, such as adding an optional field. A patch is a correction that changes nothing about the data, such as fixing a typo in a description. The version tells every consumer at a glance whether they need to act.

Make non-breaking changes cheap

Adding a field, adding a description or relaxing a rule should go through normal review with no extra process. If every change needs a meeting, producers will stop updating the contract.

Run breaking changes side by side

When a breaking change is needed, publish the new version alongside the old one, for example as a new table, view or topic. The Fowler article recommends running major versions side by side during a grace period, with statuses such as active and deprecated so consumers can see where each version stands. A safe sequence looks like this:

  1. Agree the change and the date the old version will be retired.

  2. Publish version 2 alongside version 1, with both kept up to date.

  3. Mark version 1 as deprecated and tell every consumer named in the contract.

  4. Help consumers move, and check query history to see who still reads version 1.

  5. Retire version 1 on the agreed date, once nobody reads it.

The grace period depends on the data. A few weeks is common for internal analytics. Data that feeds billing, finance or anything outside the company may need longer.

Who owns a data contract?

Ownership is where contracts succeed or fail. Each party owns a different part.

  • The producer owns the contract and the promises in it. They deliver data that meets it, test changes against it and announce breaking changes in advance.

  • Consumers own their requirements. They tell the producer what they use and what they assume, and they move to new versions within the agreed window.

  • The data or platform team owns the tooling, meaning the templates, the CI checks, the scheduled tests and the place where consumers can find contracts.

The hard part is the producer side. Application teams are measured on shipping features, and a contract adds work they did not ask for. Two things help. Keep the contract short, covering only what consumers use. And show the producer what the contract protects, such as the finance close or the billing run that depends on their table. Producers are usually glad to protect a use they know about.

How do you get producing teams to agree?

Most contract programs stall at the same point. The data team is keen, the consumers are keen, and the application team that has to keep the promises sees extra work with no benefit to them. Getting their agreement is the main job in the first few months.

Show them who depends on their data

Application teams rarely know how their tables are used downstream. A short list of the dashboards, models and reports that read their data, with the business owner of each, changes the conversation. The billing run and the board pack are things they want to protect once they know about them. Query history and lineage give you the list.

Bring the incident history

If a change from their system broke something in the past year, describe it plainly, with what it cost to fix and who was affected. Keep the focus on the missing agreement. The point is that nothing told them, which is a gap in the process, and a contract fixes it.

Make it cheap to comply

Write the first draft for them, set up the CI check, and keep the contract to the fields consumers use. A producer who only has to review a short file and see a check pass will usually agree. A producer asked to write a long document from scratch usually will not.

Give something back

A contract also protects the producer. Once consumers have agreed what they rely on, the producer is free to change everything else without asking. Many teams find that freedom worth more than the cost of the contract. Say so in the first meeting.

Get a sponsor for the first one

For the first contract, ask the business owner of the most affected output, such as the head of finance, to back it. Once one contract has caught a breaking change before it shipped, the next producer conversation is much easier.

What about files and data from outside the company?

Not every source is a database or a stream your company controls. Partners send files, vendors expose exports and agencies deliver spreadsheets. The same principles apply, with a few differences.

For external data, the contract describes what you expect to receive, and enforcement happens when the file arrives. Check the schema, the row count and the key rules at load, and reject or quarantine files that fail, with an alert to the person who manages the relationship with that partner. Share the contract with the partner so they know what will be rejected, and agree how they will tell you about changes. Some partners will sign up to a formal agreement and many will not, so the checks at load carry more of the weight.

Partner files often feed finance and regulatory reporting, which makes them Tier 1 even when the volume is small. A missing or malformed file from a payment provider can delay a month-end close as surely as a broken internal pipeline.

Should consumers write their own contracts?

Most contracts are written from the producer’s side, describing what the producer promises. Some teams also use consumer-driven contracts, where each consumer writes down the fields and rules it depends on, and the producer’s CI checks changes against all of them. The Fowler article describes this approach as an option alongside provider-owned contracts.

Consumer-driven contracts are useful when a dataset has many consumers with different needs, because the producer can see exactly which consumer a change would break. They add more files to maintain, so most teams start with one producer contract per dataset and add consumer expectations only where they help.

How do you know contracts are working?

Track a few measures from the start, so you can show what the program has changed:

  • Breaking changes caught in CI. Each one is an incident that did not happen. Record what the change was and which consumers it would have broken.

  • Incidents caused by upstream changes. This number should fall on datasets with contracts. Compare it with the year before and with datasets that have no contract yet.

  • Contract test failures in production. These show where producers are not meeting their promises, and where rules may be set wrongly.

  • Time to agree a change. If minor changes take days, the process is too heavy, and producers will start to avoid it.

  • Coverage. The share of Tier 1 datasets from other teams that have a contract.

Report these to the business owners of the protected outputs, alongside the incidents that were avoided. That report is what keeps the program funded.

How do data contracts fit into data quality?

Data contracts move part of data quality to the start of the pipeline. Most quality checks run after data has arrived, and catch problems once they exist. A contract stops a class of problems from being created, because the producer tests changes before shipping them.

Contracts do not replace the rest of a quality program. Problems still arise from bad loads, source system bugs and errors in transformation, so checks downstream remain necessary. Data quality management covers the full program, including the dimensions of quality, the checks to run at each stage and how to measure progress.

A 60-day plan to start with data contracts

A small team can put the first contracts in place in about two months. The plan assumes a warehouse, a version control system with CI and willing owners on at least one producing team.

Days 1 to 15: choose and agree

  • List Tier 1 datasets that come from another team’s system.

  • Pick one or two where recent incidents came from upstream changes.

  • Find the producing team’s owner and the main consumers.

  • Agree a contract format, such as ODCS, and where contracts will live.

Days 16 to 35: write and check

  • Hold the producer and consumer meeting for each dataset.

  • Write the contracts, covering only the fields in use.

  • Add lint and breaking-change checks to the producer’s CI, starting in warning mode.

  • Add the quality rules as scheduled tests against the live data.

Days 36 to 60: enforce and extend

  • Switch the breaking-change check from warning to blocking.

  • Run one breaking change through the side-by-side process to test it.

  • Review what the checks caught and what they missed.

  • Choose the next two or three datasets, and reuse the templates.

Templates you can copy

A change request checklist

  • Which contract and which fields does the change affect?

  • Is it a major, minor or patch change?

  • Which consumers read the affected fields, according to the contract and query history?

  • For a major change, what is the new version, and when will the old one be retired?

  • Has each affected consumer confirmed they can move by that date?

  • Have the contract’s version and status been updated in the same pull request?

A deprecation notice




The dates, names and channels in the templates are placeholders. Replace them with your own.

A worked example

Here is how a first contract plays out for one table. The details are invented to show the steps.

A subscription business copies its orders table from the app database into the warehouse every hour. Finance builds revenue from it. In one quarter, the table breaks the revenue numbers twice: once when a column is renamed and once when a new status value is added that a downstream filter drops. Both changes were correct for the app.

The data team arranges an hour with the checkout team, which owns the app, and the finance analyst who owns the revenue model. They find finance reads six of the table’s 41 columns. They write a contract for those six, with a description for each, an agreed list of status values, a rule that amounts are never negative and a freshness promise of one hour. The checkout team’s lead is named as owner, and a shared channel is set up for questions.

The contract goes into the checkout team’s repository with a CI check, in warning mode for the first two weeks and then blocking. A month later, an engineer opens a pull request that renames amount_usd to total_usd. The check fails and names the finance revenue model as a consumer. The engineer keeps the old name in the table, adds the new name as an alias in the app code, and the change ships the same day with nothing downstream affected.

Later in the quarter, the business decides amounts should include tax. That changes the field’s meaning, so the teams treat it as a major version. Version 2 runs alongside version 1 for six weeks, finance moves its model in the second week, and version 1 is retired once query history shows nobody reading it.

What mistakes should you avoid?

  • Contracts written by the data team alone. A contract the producer has not agreed to is a wish. The producer has to own it.

  • Covering every column. Long contracts are slow to agree and make every change look risky. Cover what consumers use.

  • Schema without meaning. Types and names catch renames. Descriptions, units and allowed values catch the changes that do the most damage.

  • No enforcement. A contract in a wiki drifts from the data within months. Put it in CI and test the live data.

  • Blocking everything. If every change needs approval, producers find ways around the contract. Block only breaking changes to important data.

  • Breaking changes in place. Changing a field’s meaning under the same name and version breaks consumers silently. Run a new version side by side.

  • Starting with too many. A program that begins with fifty contracts rarely finishes any. Start with two and learn from them.

Questions people ask

What is a data contract?

A written, versioned and machine-readable agreement between the team that produces a dataset and the teams that use it. It covers the schema, the meaning of each field, quality rules, service levels, owners and how changes will be handled.

What is the difference between a data contract and a schema?

A schema describes structure, meaning field names, types and which are required. A contract includes the schema and adds meaning, quality rules, service levels, ownership and change rules.

Are data contracts the same as dbt model contracts?

dbt model contracts enforce the schema of a model built in dbt. They are one way to enforce part of a data contract in the warehouse. A full data contract also covers meaning, quality, service levels and ownership, and usually applies to data before it reaches dbt.

Who should write a data contract?

The producer and the main consumers together. The producer owns it, because they are the ones who can keep its promises.

Do you need a special tool?

No. A contract can start as a YAML file in a repository with a CI check. Open-source tools such as the Data Contract CLI help with linting, breaking-change detection and testing. Catalogs and platforms can read contracts once you have them.

What format should a data contract use?

Any structured format works, and using an open standard such as ODCS makes contracts easier to share between tools. YAML is the most common choice because it is easy for people to read and for tools to parse.

What counts as a breaking change?

Any change that can make an existing consumer fail or give wrong answers. Removing or renaming a field, changing its type, making an optional field required, removing an allowed value and changing a field’s meaning all count.

How do data contracts relate to data mesh?

Data mesh gives domain teams ownership of their data as products. Contracts are a common way to define what each data product promises to its consumers, so the two often appear together. Contracts work just as well without a data mesh.

How long does it take to write a data contract?

For a single table, a first draft usually takes a meeting of about an hour plus a few hours of writing and setting up checks. Most of the time goes into agreeing what each field means, which is also where most of the value is.

Should tables built in the warehouse have contracts too?

Where another team relies on them, yes. A model the finance team builds reports on is a dataset crossing a team boundary, even though it lives in the warehouse. dbt model contracts and tests are the usual way to enforce those.

How do contracts handle personal data?

Mark sensitive fields in the contract and state who may access them and for what purpose. Tools can then use the contract to apply masking and access rules. For what the law requires of your company, ask your privacy or legal team.

What if the producing team will not agree to a contract?

Start with consumer-side checks at load, so breaks are at least caught early, and record each incident the missing contract allows. Take that record to the producer’s manager together with the business owner who was affected. Agreement is easier to win when the cost is on the table.

Can a contract be generated from an existing table?

The schema part can. Most tools can read a table’s columns and types and write a first draft. The meaning, quality rules, service levels and owners still have to come from people, and those are the parts that prevent the costly breaks.

What happens when a contract test fails in production?

Treat it like any failed check on important data. Stop the bad data from spreading, tell the consumers named in the contract and ask the producer to fix the cause. Data incident management sets out the steps. If the same rule fails repeatedly with no real problem behind it, revisit the rule with the consumer who asked for it.

For who decides what about this data, and how to make those decisions stick, read Data governance framework: who decides what about your data, and how to make it stick.

Where Dataring fits

We built Dataring to rank every dataset by how much the business depends on it, then act on that ranking. Data behind billing, finance, regulators and customer-facing products is identified from how it is actually used, so you know which datasets need a contract first, and its owners hear first when something goes wrong, while pipelines nobody depends on are retired within limits each company sets, under its supervision.

Book a free call to see it on your data estate. For the wider process this guide fits into, read How to audit your data estate in seven steps.

Newsletter

Product news by email. We use your address for nothing else.

© 2026 ShareData Inc.Last updated October 29, 2026