Data Products, Data Mesh and Contracts Between Teams
Why data breaks between teams, what a data product is, how data mesh and data fabric organise ownership and metadata, what a data contract promises, and how to tell a compatible change from a breaking one before you ship it.
Contentsand lesson path
On this page
- Why it matters
- Data products, data mesh and data fabric
- What a data contract promises
- Compatible and breaking changes
- Check your understanding
- Apply it
- Review prompt
Lessons of Data Contracts & Governance
- Data Products, Data Mesh and Contracts Between Teams Concept · 20 min
- Lab: Enforcing a Contract and Shipping a Breaking Change Lab · 25 min
- Lineage: Recording and Querying the Data Graph Worked example · 25 min
- Lab: Catalog Entries, Classification and Access Control Lab · 25 min
- Protecting Personal Data: Pseudonymize, Encrypt, Retain, Erase Worked example · 30 min
- Check: Governance Review of a Pipeline Knowledge check · 10 questions
What you will learn
- Write a data contract covering schema, semantics, quality expectations, freshness SLA, owner and version, enforce it at the producer boundary, and roll out a breaking change with a deprecation window.
01. Why it matters
On Monday the checkout team renames a column in the orders table, because the old name was confusing. Their application works, their tests pass, and they ship. On Tuesday the finance dashboard shows zero revenue, a machine learning model starts scoring every customer as new, and three teams spend a day finding out why. Nobody did anything careless. The checkout team simply did not know who used their data or what those people relied on.
Data governance is the set of agreements, roles and controls that make data dependable and safe to use: who owns each dataset, what it means, who may read it, how long it is kept, and how it may change. This skill covers the main pieces: contracts between teams (this lesson and the next), lineage, catalogues with access control, and the protection of personal data. Each one turns an informal assumption, "surely nobody uses that column", into something written down and checked by machines.
02. Data products, data mesh and data fabric
A data product is a dataset that a team publishes on purpose, for others to use, and looks after as it would look after any product. It has a named owner, documentation, a clear interface (the tables, files or API through which people read it), quality checks and a promise about how fresh it is. The idea comes from data mesh, an approach described by Zhamak Dehghani in 2019 and 2020. It rests on four principles:
- Domain ownership. The team that knows the business area, for example checkout, owns its analytical data as well as its application, instead of handing raw tables to a central data team that does not know what they mean.
- Data as a product. That team serves its data so that others can find it, understand it, trust it and use it securely, and measures whether consumers succeed.
- A self-serve data platform. A platform team provides shared tooling (storage, pipelines, catalogue, access control) so that each domain team can publish data products without becoming infrastructure experts.
- Federated computational governance. Domain and platform owners agree global rules together, such as how personal data is tagged or how products are named, and the platform enforces those rules automatically in every domain.
Data mesh is mainly about organisation and ownership, and it fits large companies with many domains better than a small team with one warehouse. Data fabric is a different, complementary idea: an architecture that connects data across many systems through shared metadata. It relies on active metadata, metadata that tools use continuously rather than a static catalogue that people read, for example lineage that triggers an alert when an upstream table changes. A company can have both: domains that own products, and a fabric of metadata that links them.
03. What a data contract promises
A data contract is the written, machine-checkable promise that a producer makes to its consumers about one data product. A useful contract answers six questions:
- Schema: which tables and columns exist, with types and which values may be missing.
- Semantics: what each field means, in plain words and units. "Amount in euros, including VAT, before refunds" prevents more bugs than any type.
- Quality: the rules the data always meets, such as unique order ids or a status from a fixed list.
- Freshness: a service level such as "loaded within six hours of midnight UTC".
- Owner: who is accountable, and where to ask or report problems.
- Version: which version of the promise this is, and how changes will be announced.
The Open Data Contract Standard (ODCS), version 3.2.0 from the Bitol project of the Linux Foundation, defines a YAML format for all of this, and tools can test a dataset against it. A contract is checked where it can prevent damage: in the producer's own pipeline and CI, before data is published. The next lesson does exactly that.
04. Compatible and breaking changes
Contracts are versioned with semantic versioning: MAJOR.MINOR.PATCH. A patch fixes something consumers do not rely on, such as a typo in a description. A minor version adds something without breaking existing readers. A major version breaks at least one existing reader, so it needs a migration plan: publish the new version next to the old one, announce a deprecation window, and retire the old version when consumers have moved.
Judge a change from the consumer's side. Adding an optional column is compatible for readers that select columns by name. Removing or renaming a column, changing its type, or allowing nulls where there were none can break a reader. The small script below classifies five changes to an orders schema.
"""Classify a schema change from the consumer's point of view."""
V1 = { # column -> (type, required)
"order_id": ("string", True), "customer_id": ("integer", True),
"amount": ("decimal", True), "status": ("string", True),
}
CHANGES = {
"add optional channel": {**V1, "channel": ("string", False)},
"rename amount": {("amount_gross" if c == "amount" else c): v
for c, v in V1.items()},
"make status optional": {**V1, "status": ("string", False)},
"customer_id to string": {**V1, "customer_id": ("string", True)},
"amount in cents": V1, # same schema, different meaning
}
def classify(old, new):
breaks = []
for column, (kind, required) in old.items():
if column not in new:
breaks.append(f"{column} removed")
elif new[column][0] != kind:
breaks.append(f"{column} {kind} -> {new[column][0]}")
elif required and not new[column][1]:
breaks.append(f"{column} may now be null")
if breaks:
return "major (breaking): " + ", ".join(breaks)
added = sorted(set(new) - set(old))
if added:
return "minor (compatible): added " + ", ".join(added)
return "no schema change"
for name, schema in CHANGES.items():
print(f"{name:<22} {classify(V1, schema)}")python3 compat.pyadd optional channel minor (compatible): added channel
rename amount major (breaking): amount removed
make status optional major (breaking): status may now be null
customer_id to string major (breaking): customer_id integer -> string
amount in cents no schema changeThe last line is the important one. Storing amounts in cents instead of euros changes no name and no type, so no schema check can see it, yet every consumer's numbers become wrong by a factor of 100. A change of meaning is a breaking change. Schema tools catch structural breaks; people must catch semantic ones, which is why the contract states the meaning of each field and why a producer reviews changes with the contract in hand. Note also that "compatible" depends on how consumers read: a reader that takes columns by position, such as some CSV loaders, breaks even when a column is only added.
05. Check your understanding
06. Apply it
The skill practice starts with a versioned contract for the main output of a pipeline you built. Before you write any YAML, answer the six questions above for that output on one page: schema, meaning of every field (with units), quality rules, freshness, owner and version. Then list three changes you expect in the next year, and classify each as patch, minor or major with one sentence of reasoning. You will turn the page into an enforced contract in the next lesson.
07. Review prompt
Without looking back, explain: what makes a dataset a data product; the four principles of data mesh; how data fabric and active metadata differ from data mesh; the six things a data contract states; and why a change of units is a breaking change that no schema check can see.
References
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.