A data contract that lists only column names and types is half a contract. It tells you the shape of the data. It does not tell you what the data means.
Shape checks are easy to automate, so most teams stop there. Then a column called amount arrives on time, as a decimal, never null. Every check passes. The dashboard is still wrong, because amount changed from net to gross last month.
This post is about the other half. I call it a semantic contract: the written meaning that sits beside the schema.
What a type check cannot catch
A type check answers one question: is this value the right kind of thing? It cannot answer these:
- Is this the right thing?
- At the right level of detail?
- In the right unit?
- As of the right time?
- Owned by someone who will tell me before it changes?
Each of these failures produces a valid-looking number. That is why they last so long. Nothing breaks. The number is just quietly wrong, and someone makes a decision with it.
Six things to add to a contract
1. Business definition
Write one sentence per field in the words a business reader would use. "Customer" is the classic case. Sales, support and finance often mean three different things by it. The contract should say which one this field holds, and what it excludes.
If you cannot write the sentence, that is a finding. It means the field has no agreed meaning yet.
2. Grain
Grain is what one row represents. One row per order? Per order line? Per customer per day?
State it as a sentence and name the key that makes a row unique. Most wrong totals I see come from a join that changed the grain without anyone noticing. A contract that states the grain gives you something to test: the key is unique, and the row count behaves as the sentence says.
3. Units and currency
A number without a unit is a guess. Say whether it is dollars or cents, kilograms or grams, a ratio or a percentage. For money, say the currency and whether it is gross or net of tax and fees.
Put the unit in the contract, not only in someone's head. Better, put it in the column name too.
4. Temporal meaning
Time is where the most arguments start. For each date field, say which event it records. Created, shipped, paid and booked are different moments. Say which time zone it uses.
Then say how the data changes over time:
- Is a row final once written, or can it be revised?
- How late can new rows arrive for an old date?
- Is the table a snapshot of now, or a history of every state?
A report that reads "yesterday" from a table that is still being corrected will disagree with itself tomorrow. The contract should say so up front.
5. Ownership
Every contract needs a named owner on the producing side. This is a person or a team, not "data". The owner answers questions about meaning and agrees to tell consumers before changing it.
Without an owner, a contract is a document. With one, it is a working agreement.
6. Compatibility expectations
Say what counts as a breaking change, and what notice consumers get. A useful starting split:
- Safe: adding a new nullable column.
- Breaking: removing a column, renaming it, or changing its type.
- Also breaking, and often missed: changing the meaning, grain, unit or time basis while keeping the name and type.
That last line is the point of the whole exercise. A purely structural contract treats a meaning change as safe, because the schema did not move.
Read the full post: https://hikmahtechnologies.com/blog/semantic-data-contracts/
https://hikmahtechnologies.com/blog/semantic-data-contracts/
