guide
guide9 min read

Open data contract standard explained: what to put in a contract and who enforces it

The ODCS fields, a full YAML example, and which layer enforces each clause

The Open Data Contract Standard (ODCS) is a vendor-neutral YAML specification, maintained by the Bitol project under the Linux Foundation's AI & Data umbrella, that describes a dataset's schema, quality rules, service-level properties, ownership and terms of use in one machine-readable file. The standard defines what a contract says. It does not enforce anything: your warehouse, your transformation layer, your orchestrator or an agent has to read the file and act on it.

Key Takeaways

  • •ODCS is a file format, not a runtime. A contract that nothing reads is documentation, and documentation drifts.
  • •A useful contract has five parts: identity and ownership, schema, quality rules, SLAs and terms of use. Start with the first three.
  • •Different layers enforce different clauses. Build-time constraints catch shape problems, pre-publish audits catch value problems, and monitoring catches freshness and volume problems.
  • •Per-column breaking-change rules (remove, retype and rename are breaking; add-nullable is not) are what make a contract useful to a consumer. This is our working rule, not part of the spec.
  • •An AI coding agent connected over MCP can read the contract file and the lineage, then answer 'is this change safe?' before the pull request is opened.

Open data contract standard explained: the YAML, field by field

ODCS v3 is a single YAML document with a fixed top-level shape. The fields below are the ones we see teams use first. The example is written against v3.0.2 of the standard; the spec documentation lists every field and its allowed values.

yaml apiVersion: v3.0.2 kind: DataContract id: orders-contract-001 name: orders version: 1.2.0 status: active domain: commerce dataProduct: orders description: purpose: Order facts for finance and growth reporting. limitations: Test orders are excluded. schema: - name: orders physicalName: analytics.gold.orders properties: - name: order_id logicalType: string physicalType: varchar primaryKey: true required: true - name: customer_id logicalType: string required: true classification: restricted quality: - type: library metric: nullValues mustBe: 0 - name: order_total logicalType: number physicalType: decimal(12,2) required: true - name: order_ts logicalType: timestamp required: true quality: - type: library metric: rowCount mustBeGreaterThan: 0 slaProperties: - property: latency value: 4 unit: h element: orders.order_ts

Reading it top to bottom: apiVersion pins the spec version and kind is always DataContract. id, name, version and status identify this contract and its lifecycle state. domain and dataProduct place it in your org. description carries purpose and limitations, which is where you record what the data must not be used for. schema is a list of objects (tables), each with properties (columns) carrying logicalType, physicalType, required, primaryKey and a classification tag for sensitivity. quality blocks attach to a column or a whole table, and slaProperties declares things like latency, freshness windows and retention as a property, value and unit.

What to put in a contract on day one

Our opinion: write the smallest contract that would have prevented your last two incidents. For most teams that means primary keys, required columns, types, a null check on the join key and one latency SLA. Add classification tags to any column that holds personal data, because that is the clause a governance review will ask for first.

  • •Identity and ownership: id, name, version, status, domain, and a named owning team. A contract with no owner has nobody to page.
  • •Schema: every consumed column with its logical type, and required and primaryKey where true. Leave unused columns out so the producer stays free to change them.
  • •Quality: one or two quality rules per critical column, not twenty. Null checks on keys and a row-count floor catch most real breakage.
  • •SLAs: one slaProperties entry for latency or freshness, tied to a timestamp column through element.
  • •Terms: the description.limitations text. State what the table is not fit for.

Breaking-change rules a contract should state

The spec gives you a version field but does not tell you what a major bump means. We apply this rule and recommend writing it down next to the contract: removing a column, changing a type, renaming a column, tightening nullability and loosening a quality threshold are breaking changes and need a major version. Adding a nullable column is not breaking. Widening a type (for example, int to bigint) is a judgment call, and we flag it for human review.

The rename case is the one teams get wrong. A rename of customer_id to buyer_id looks harmless in a pull request diff, but every downstream join on customer_id returns zero rows or errors. Under the rule above it is a removal plus an addition, so it is breaking.

Who enforces a data contract

ODCS describes the agreement. Enforcement is split across layers, and no single layer covers every clause. Mapping each clause to the layer that can actually check it is the part most explainers skip.

Contract clauseEnforcing layerWhen it firesWhat it cannot see
Column names, types, required, primaryKeyBuild-time model contracts and constraintsOn build, before the table is replacedWhether the values are correct
quality rules (nulls, row count, ranges)Pre-publish audit (write-audit-publish)After staging write, before consumers see dataSlow drift that stays inside thresholds
slaProperties latency and freshnessScheduled monitor or orchestrator checkAfter the fact, on a scheduleWhy the run was late
classification and access termsGovernance and access-control layerAt query and grant timeSemantic misuse of permitted data
Breaking-change rules and consumer impactReview-time check with lineageBefore mergeConsumers outside the lineage graph

On the build-time row: dbt model contracts check that a model's returned columns match the declared names and data types, and dbt also supports declaring constraints such as not_null and primary_key. How strictly those constraints are enforced depends on the warehouse, per dbt's documentation. dbt contracts are configured in dbt's own YAML, so teams that adopt ODCS usually generate or sync one from the other rather than maintaining both by hand.

Write-audit-publish: where quality clauses actually block

Write-audit-publish (WAP) is the pattern that turns a quality block from an alert into a gate. The job writes to a staging table, an audit step runs the contract's quality rules against staging, and only a passing run is published to the table consumers read. If the audit fails, consumers keep yesterday's data and the producer gets the failure. This is what 'shift quality left' means in practice: the check sits in the producer's pipeline, not in a dashboard the consumer has to watch.

The cost is a staging copy and a delay before publish, and it works best when quality rules are cheap to evaluate. Put the null check and row-count floor in the audit. Leave expensive distribution checks to monitoring.

A worked example: the rename that passes review

Here is the scenario we use to test any contract setup. A producer renames customer_id to buyer_id in the orders model. The model builds, the producer's tests pass, and a downstream revenue join silently drops to zero matches. The contract above would stop this in two places: the build-time contract fails because customer_id is declared required and is now missing, and the WAP audit fails the nullValues rule if the column comes back empty.

The better place to catch it is before the pull request merges. That needs something that holds the contract and the lineage together and can answer the question developers actually ask: "What's the blast radius if I drop this column?" or "Is the customer_id join safe after the migration?"

Where agents and MCP fit

The Model Context Protocol lets an AI coding agent such as Claude Code or Cursor call tools on a server over a standard interface. A contract is a good fit for that interface because it is structured and small. The following exchange is illustrative of the shape, not a transcript from a specific server:

Prompt in Claude Code: "I'm renaming customer_id to buyer_id in the orders model. Is that allowed under the orders contract?" The agent calls a contract-check tool with the contract id and the proposed column diff. The tool returns: breaking change on orders.customer_id (removed, required: true); contract version must move from 1.2.0 to 2.0.0; three downstream models reference the column. The agent then proposes either keeping both columns for a deprecation window or opening the major-version change with the consumer list attached.

Our Schema Agent does the drift and impact half of this: it compares a proposed or deployed column change against the declared schema and projects the downstream effect. Our Quality Agent covers the audit half by running the contract's rule-based checks. The OSS edition is Apache 2.0 and read-only by default, so it can answer these questions without write access to your warehouse; writes and approval workflows sit in Pro. We would rather you verify that in the repository than take our word for it.

We covered the broader idea of agents sharing context across schema, quality and governance on the Data Workers site. The short version for contracts is that the file only helps if something reads it on every change, and an agent in the engineer's terminal is the reader that is already there.

What this post covers that the usual overviews skip

Most contract write-ups stop at the YAML. We focused on the enforcement table and the breaking-change rules because those are the two decisions a team has to make that the standard leaves open. If you only take one thing: decide, per clause, which layer owns it, and write that next to the contract.

Frequently Asked Questions

What is the open data contract standard? It is ODCS, a YAML specification maintained by the Bitol project that defines a common structure for data contracts: identity, schema, quality rules, SLAs and terms of use. It is vendor-neutral and versioned through apiVersion.

Does ODCS enforce my data contract? No. ODCS is a description format. Enforcement comes from build-time model contracts, pre-publish audits, monitors, access control or a review-time check, depending on the clause.

Is an ODCS contract the same as a dbt model contract? No. A dbt model contract checks a model's output against declared column names, data types and constraints inside dbt. An ODCS contract also covers ownership, quality rules, SLAs and terms, and it lives outside any one tool. Teams often keep one as the source of truth and generate the other.

How many quality rules should a first contract have? Few. We suggest a null check on each join key, a row-count floor and one latency SLA. Add rules when an incident shows a gap, not before.

Can an AI agent enforce a data contract? An agent can read the contract, check a proposed change against it and report the breaking changes and affected consumers before merge. Blocking publishes still belongs in your pipeline, through a pre-publish audit.