Enforcing a data contract without a lawyer and without breaking the show
Enforcing a data contract means running each clause as an assertion against the raw file before it loads, and deciding in advance what a failure does. Key clauses hold the file at a single failure. Value clauses hold it only when the failure rate exceeds the allowance the contract already states.
A contract nobody tests is a memo. The clauses were agreed, the YAML file sits in the repository, and eleven months later a file arrives with 40 per cent of its country column empty and loads without complaint, because nothing between the vendor's export job and your warehouse ever reads the document.
Enforcing a data contract is the step that turns those clauses into code that runs on every file. It needs no legal process and no vendor cooperation, and the hard part is not the tests. It is deciding, in advance and in writing, what a failure does on the Tuesday of show week.
Where the assertions have to run
At the boundary, against the raw file, before anything transforms it.
The sequence is: land the file in a staging area untouched, run the assertions against it there, then either promote it into the warehouse or hold it. Testing after the transform tells you the transform's output is wrong without telling you whether the source or your own code caused it, and by then a partial load may already have replaced yesterday's numbers.
Great Expectations describes an expectation as a verifiable assertion about your data, and calls out that expectations make implicit assumptions explicit. That is the whole design goal at the boundary. Every assumption your loader silently makes about the file becomes a line somebody can read.
Sanderson, Freeman and Schmidt, in their 2025 book on data contracts, put continuous integration and monitoring among the components of the architecture they set out, and the continuous integration half is worth taking literally. The contract file and the assertions live in the same repository as the loader, so a pull request that changes a transform runs the same checks against a sample file before it merges. Enforcement that only exists in production is enforcement that gets discovered at 06:00.
The four tests that cover most clauses
dbt Labs' documentation, in its 2026 revision, ships four built in generic data tests, and between them they cover most of what a registration feed's contract says.
- unique. The primary key clause. One registration id per row within the edition.
- not_null. The required column clause, and with a threshold config on top, the allowed null rate.
- accepted_values. The categorical clause. Badge type is one of the six values the show actually sells.
- relationships. Referential integrity. Every exhibitor id in the leads file exists in the exhibitor dimension, which is the check that would have caught a rename nulling a join.
Each test takes a severity config of warn or error, and the documentation also provides error_if and warn_if for custom failure thresholds, which is how a single test expresses that three bad rows is a warning and eight thousand is a failure. Great Expectations covers the same ground with a wider library, including the mostly parameter on null and validity expectations, documented as a float between 0 and 1 where the check passes if at least that fraction of values match.
Two clauses need something beyond the built in tests. The arrival window is a check on when the file appeared rather than on its contents, so it belongs in the orchestrator as a missed schedule alert. And key stability across exports needs the previous file retained and compared, which is a query rather than a test.
Should a failed check stop the load?
Decide it per clause, and decide it before the alert, because at 06:00 with a show opening on Thursday nobody makes this decision well.
Take a registration file of 41,000 rows where 3 rows fail the country validity check. That is 3 divided by 41,000, or 0.0073 per cent. Quarantining the file costs you the entire day's registrations across every report, while loading it costs you 3 wrong rows in a country breakdown that rounds to the same percentages either way. Hold the file and you have created a bigger outage than the vendor did.
Now take the same file with 8,200 rows failing. That is 20 per cent, the contract allowed 2 per cent, and the failure is ten times the allowance. Something upstream has changed and loading it will silently corrupt every geographic figure in the estate. Hold it.
The rule that falls out of those two cases is a split by clause type.
Key clauses quarantine at a single failure. A duplicate primary key, a missing required column, a broken referential relationship: each of those makes downstream results wrong in ways that are expensive to unpick, and one instance proves the guarantee is broken.
Value clauses quarantine only above the allowance the contract already states, with a multiple attached. Below the allowance, pass. Above the allowance but under, say, three times it, load the file flagged and put it in front of a person the same day. Above three times, hold. The multiple is arbitrary and you should tune it once you have a quarter of history.
What show week does to the rules
The cost of a held file inverts during a show, and a policy that ignores this will eventually stop a badge print queue.
Outside a show window, holding a registration file delays a pacing report by a day and nobody is harmed. During show week, that same file is feeding on-site check-in and badge printing on a fifteen minute cycle, and a quarantine over 3 bad country codes means people standing at a registration desk. The correct behaviour flips: during the show window, value clauses degrade to warnings and only the key clauses hold anything, because a duplicate badge id genuinely does break the desk while an empty country field does not.
Write the window into the enforcement config as dates, alongside the contract. Two rules, one of which applies between the on-sale date and 48 hours after show close, and a note saying which one is active in the alert itself, so the person reading it at 06:00 knows which regime they are in without going to look.
The same inversion applies to who is told. Outside a show, a held file goes to a channel. During a show, it goes to a phone, because the person who can clear it is on a floor somewhere with 40 minutes before doors open.
How do you enforce a contract nobody signed?
Exactly the same way, minus the remedy conversation.
Assertions do not check for a signature. If your vendor refused to agree the clauses, the tests still run, the file is still held, and you still know within minutes of arrival that something changed. What you lose is the ability to demand anything afterwards, and what you gain is a log.
That log is the argument for the next renewal. Twelve months of assertion results gives you the count of days the file arrived late, the count of schema changes that arrived with no notice, and the number of times a load was held. Those numbers travel further in a procurement meeting than any complaint about data quality, because they are countable and dated. Building the evidence is part of the reason to write the contract at all, which K27 argues.
Where enforcement stops
Assertions catch what somebody thought to assert, and the failures that hurt most are the ones nobody imagined. A file can pass every clause and be last week's file resent, or this week's file with one show missing from it, and neither triggers a uniqueness, presence or validity check. Row count and freshness monitors are a separate layer with their own thresholds.
The quarantine itself is the more common failure. A held file goes to a folder, an alert goes to a channel, and if no named person owns clearing it, you have converted a data quality problem into a silent outage. Three days later somebody notices the pacing report has flatlined. The quarantine needs a daily check by a person, an age on every held file, and an escalation when anything sits in there past 24 hours, and that process needs to exist before the first hold rather than after it.
There is a limit on precision as well. Every threshold you set is a guess until you have history, and a threshold set from a single quiet month will fire constantly in the eight weeks before a show. Run every assertion in warn only mode for a full quarter, count the failures, and turn on the holds afterwards. A quarter feels slow, and it is much faster than switching the whole system off in week three because it stopped a load it should not have.
Start by taking last month's files, running the clauses against them without enforcing anything, and counting the failures per clause. If a clause fails on 18 of 30 days, the clause is wrong. If it fails on none, you learn nothing about whether it works and should introduce a deliberately broken file to prove the assertion actually fires. Then wire the shape check from the ordered column hash in K21 into the same gate, and read the clause definitions straight out of the YAML the contract already lives in from K28, so your unified data loaders and your agreement can never drift apart.
Questions people ask about enforcing a data contract
- How do you enforce a data contract without legal action?
- By running the clauses as automated assertions at the point the file arrives, and by writing down beforehand what each failure does. Enforcement in practice means a held file, a flagged load and a named person, all of which work without a signature. The legal route matters only for remedy, which is rarely the useful part.
- Should a failed data quality check stop the load?
- It depends on which clause failed. A duplicate primary key or a missing required column should stop it, because everything downstream will be wrong in ways that are hard to unpick. A handful of rows failing a value check should not, since quarantining a whole file over three bad rows costs more than the rows do.
- What tools enforce data contract clauses?
- The built in tests in dbt cover uniqueness, presence, permitted values and referential integrity, with severity and threshold configs that decide whether a failure warns or errors. Great Expectations covers the same ground with a larger library of expectations, including fractional thresholds for null and validity checks.
Related reading
- Data contracts with registration vendors that survive a change of platform
- What belongs in a data contract for an event data feed
- Schema drift detection for the exports you did not write and cannot control