# Data Contract

> A written deal on what data will look like. Its maker keeps to it.

**Field:** Data Engineering  
**Category:** Governance & Quality  
**Also known as:** Data Contracts, Schema Contract

## Think of it like

A baker promises a cafe ten loaves each morning. The cafe plans its day around that.

## Definition

A data contract is a written agreement between the team that makes data and the teams that use it. It lists the columns, their types and what each one means. It sets quality rules and how fresh the data will be. It names an owner to contact. The contract is kept as a file, and checks enforce it on every change. A change that would break it must be agreed first.

## Example

The app team wants to rename a column. The contract check fails in their pull request, so they talk to the analytics team before the change ships.

## Example code

```yaml
models:
  - name: orders
    config:
      contract:
        enforced: true
    columns:
      - name: order_id
        data_type: int
        constraints:
          - type: not_null
```

A dbt model contract. The build fails if the table's columns or types drift from this file.

## Why it matters

Most broken pipelines start with a change no one was told about. A contract turns that shock into a talk.

## Common mistake

Writing the contract as a page nobody checks. Without a test in code, it drifts from the truth within weeks.

## Three principles

- **Maker and user.** Both sides agree the terms.
- **Shape and quality.** Columns, types, rules and freshness.
- **Enforced in code.** Checks fail on a breaking change.

## Related terms

- [Data Quality Check](https://learn.benibix.com/term/data/data-quality-check)
- [Data Product](https://learn.benibix.com/term/data/data-product)
- [Schema Registry](https://learn.benibix.com/term/data/schema-registry)
- [Data SLA](https://learn.benibix.com/term/data/data-sla)
- [Schema Drift](https://learn.benibix.com/term/data/schema-drift)

![A producer team on the left sends orders data through a contract box in the middle, listing columns and types, quality rules, freshness within 1 hour and an owner. A consumer team on the right reads it. A dashed change arrow from the producer is stopped at the contract with a note: breaking change, agree first.](https://learn.benibix.com/diagrams/data-contract.svg)

---

Source: https://learn.benibix.com/term/data/data-contract
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
