(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon
Data contracts in Microsoft Fabric: ensuring quality in ETL
Data Engineering

Data contracts in Microsoft Fabric: ensuring quality in ETL

João Barros 20/08/2026 7 min

“Without data contracts, pipelines are vague promises; with contracts, they are executable agreements.”

Why data contracts are no longer optional

In modern analytic architectures — lakehouses, Spark pipelines and reporting models in Power BI — most critical incidents begin with a silent breach of expectations about the data: columns that disappear, formats that change, volumes that spike. These breaks quickly translate into incorrect reports, wrong business decisions and, sometimes, financial losses. In environments with hundreds of sources and dozens of pipelines, the mean time to detect a regression can be hours or days; with data contracts that time is substantially reduced.

Data contracts in Microsoft Fabric: ensuring quality in ETL

A data contract is, in practical terms, a minimal set of explicit expectations about a table or data stream — schema, types, cardinalities, plausible ranges and latency SLAs. When these agreements are operationalized, data engineers stop reacting to incidents and start proactively avoiding them.

What a practical data contract should contain

A useful data contract combines simplicity with the ability to be automated. It should include, at least:

  • Contract identifier (name, version, owner);
  • Expected schema (columns and types), mandatory rules and null tolerance;
  • Business invariants (e.g.: maximum percentage of null values, unique keys, values within acceptable ranges);
  • Operational metrics and SLAs (maximum time from ingestion to curated layer, minimum volume per window);
  • Defined actions in case of violation (reject, quarantine, notify);
  • Automated tests and promotion criteria between environments (dev → staging → production).

Because complexity grows with the ecosystem, a contract should be modular: have an immutable core (e.g.: primary keys) and rules that can evolve with explicit versioning. The product team and source owners should be involved: contracts act as agreements between teams and not just as technical documents.

How to implement data contracts in Microsoft Fabric

Microsoft Fabric provides the components needed to operationalize data contracts: OneLake / Lakehouse to store Delta data, Spark Notebooks and Jobs for transformation and validation, and pipelines for orchestration. A practical implementation follows these lines:

1) Define contracts in YAML or JSON files versioned in a Git repository associated with the Fabric workspace. Each contract contains schema, thresholds and evolution policies. Versioning allows comparing and auditing changes.

2) Apply enforcement at write time for sensitive layers: use Delta tables in the Lakehouse with write policies controlled by Spark Jobs. Before accepting a batch, run a validation that checks required columns, types and invariants; on failure, write the batch to a 'quarantine' area and emit alerts. This approach prevents invalid data from contaminating the curated layer.

3) Implement contract tests as parameterizable notebooks in Spark (PySpark or Spark SQL). These notebooks run the assertions, produce metrics and generate a structured report (JSON) with the result. Notebooks are versioned and executed as scheduled Jobs or integrated into CI/CD pipelines.

4) Integrate validation libraries, such as Great Expectations, which has Spark integration and allows turning human rules into executable checks. Complement with SQL-written rules for quick checks in Power BI Dataflows, if needed.

Automated tests, CI/CD and artifact promotion

A contract truly exists when it is tested automatically and is part of the promotion flow between environments. In Fabric, the following promotion pipeline is recommended:

Dev → Pull request → Automatic integration (unit and contract tests) → Staging (runs validations on sample data) → Prod (promotion only if tests pass and SLAs are met).

Practical implementation:

  • Use Git repositories integrated with the Fabric Workspace to store notebooks, pipeline definitions and contract files;
  • Configure CI pipelines that, when a pull request is opened, run a reduced set of tests: schema checks, small data smoke tests and notebook linting;
  • In the staging environment, run a full suite with representative samples (e.g.: 1% to 5% of volume or Jan/Feb/…). If validations fail, automatically open a ticket with logs and failure samples;
  • Automate promotion to production only after manual approval from the contract owner or when the failure rate is zero for a defined observation period.

This discipline reduces regressions and creates clear accountability for contract changes.

Monitoring, metrics and actionable alerts

Having tests is fundamental, but without continuous monitoring regressions appear. An observability system for data contracts should provide 3 layers of information: operational metrics, alerts and diagnostic dashboards.

Essential operational metrics:

  • Contract test success rate per day/per pipeline;
  • Percentage of null values per column in the last 24h;
  • Variation of expected volume per window (e.g., when daily volume differs >20% from the baseline);
  • Mean time to resolve failures (MTTR) and number of quarantine events.

These metrics can be aggregated and exposed in Power BI dashboards that summarize the state of contracts by domain. Alerting rules should be practical: emails for non-critical incidents, messages in a Slack/Microsoft Teams channel for failures requiring intervention, and, in severe cases, escalation to on‑call. For example, an increase in nulls for the 'customer_id' column above 2% during a 1-hour window requires quarantine and immediate investigation.

Data contracts turn pipeline noise into clear — and manageable — signals.

Mini practical case: online retailer that reduced data failures

In an online retailer with 120 employees and an 8-person data team, the system processed on average 3 million transactions per month from 6 distinct sources (website, mobile, POS, logistics, CRM and partners). Before data contracts, the reporting department detected issues on average 18 times per month — each event translated into 4 hours of work to fix, manual validation and report regression. The estimated direct cost of fixes was around €10,000 per month.

The team implemented a data contracts program at the ingestion and curation layer with the following concrete measures:

  • Definition of contracts for 12 critical tables (transactions, customers, inventory, shipments);
  • Automated validations in Spark Notebooks that ran as nightly Jobs and on each commit in the Git repository;
  • Quarantine rules that isolated failing batches and triggered Teams alerts with samples and schema diffs;
  • Power BI dashboards with daily metrics and SLAs, accessible to product and operations teams.

Measured results after 3 months:

  • Reduction of critical data events from 18 → 5 per month (‑72%);
  • MTTR reduced from 4 hours → 45 minutes;
  • Monthly operational cost reduced from ~€10,000 → ~€2,200 (includes team hours and reduced business impact);
  • Reporting user trust increased: adoption rate of new dashboards rose 35% due to fewer discrepancies.

This mini case demonstrates that data contracts are not a luxury: they make processes more efficient, reduce costs and accelerate decision-making with reliable data.

Best practices and pitfalls to avoid

Best practices:

  • Start with the highest-risk domains (payments, inventory, customers) and expand iteratively;
  • Automate all possible validations and keep fast tests that run on each commit;
  • Version contracts and assign a clear owner to each; contracts without an owner tend to become outdated;
  • Record validation results in a metrics repository — this enables historical analysis and detection of gradual drift.

Common pitfalls:

  • Requiring overly strict validations from the outset — this leads to many false positives. Adopt pragmatic thresholds and increase sensitivity over time;
  • Ignoring communication between teams. Changes in sources are inevitable; agree on channels and notification policies with data providers;
  • Relying only on static tests. You need to combine smoke tests with validations over real samples.

In summary

  • Data contracts formalize expectations about data and enable automating rejection, quarantine and alerts for incidents;
  • In Microsoft Fabric, combine Lakehouse (Delta), Spark Notebooks/Jobs and CI/CD with Git to implement auditable contracts;
  • Automate validations, record metrics and expose operational dashboards to reduce MTTR and costs;
  • Start with critical domains, adopt pragmatic thresholds and ensure clear owners for each contract.

Implementing data contracts is an investment in the foundation of analytical reliability. For data teams working with Microsoft Fabric, the path is concrete: version contracts, run tests as part of CI/CD, enforce at write time and monitor continuously.

Would you like to discuss how to transform a catalog of issues into a set of executable contracts in your organization? Which sources worry you most right now and would you like to see covered by a contract in a 4‑week pilot?

← Back to insights
Let's talk?

Ready to transform your data?

Book a free 30-minute meeting and find out how we can help your team make better decisions.

Book a Free Meeting
bConcepts