Company
Date Published
Author
Adrian Brudaru, Co-Founder & CDO
Word count
883
Language
English
Hacker News points
None

Summary

Data contracts serve as an architectural mechanism to ensure reliable interfaces between decoupled systems by encompassing both agreement and enforcement elements. The agreement aspect involves a mutual understanding between data producer and consumer teams about the rules data must follow and the actions to take if these are breached. The enforcement aspect involves technical mechanisms that test data against these rules, rejecting any non-conforming data. A simple data contract example involves a gym aggregator company where SQL tests alert the sales team about unassigned CRM companies, allowing them to correct data and ensure accurate purchase attribution. A more complex scenario involves client-side event tracking, where agreements are made with development teams to ensure clean data is sent, while enforcement is used to block malicious users. In cases like using LLMs for data extraction, only enforcement is possible due to the absence of an agreement counterpart. Data contracts can also be configured with varying enforcement levels to allow for schema evolution while maintaining data quality. Ultimately, data contracts are less about trust and more about enforcing constraints to ensure data quality, as they replace the variability of human behavior with the predictability of code-enforced rules.