🛡️Data Contract
Also known as Data Contracts, Schema Contract
A written deal on what data will look like. Its maker keeps to it.
Think of it like
A baker promises a cafe ten loaves each morning. The cafe plans its day around that.
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.
Why it matters
Most broken pipelines start with a change no one was told about. A contract turns that shock into a talk.
Definition
Example code
yaml
models:
- name: orders
config:
contract:
enforced: true
columns:
- name: order_id
data_type: int
constraints:
- type: not_nullCommon mistake
Key takeaways
- 1Maker and user. Both sides agree the terms.
- 2Shape and quality. Columns, types, rules and freshness.
- 3Enforced in code. Checks fail on a breaking change.