(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon
Data Engineering: Idempotent pipelines in Microsoft Fabric
Data Engineering

Data Engineering: Idempotent pipelines in Microsoft Fabric

João Barros 10/09/2026 6 min

A pipeline that can be run 100 times and produce the same result is often more valuable than a pipeline that runs faster but fails when reprocessed.

Why idempotence matters in data pipelines

In an ecosystem analyzed by bConcepts, the usual operational storms — reprocessings after incidents, data quality corrections and ad hoc reconciliations — consume 20–30% of data engineering teams' time. Idempotence is the property that turns that ad hoc work into predictable operations: if a job fails and is rerun, the result is not corrupted nor are entries duplicated.

Data Engineering: Idempotent pipelines in Microsoft Fabric

Besides reducing operational effort, idempotent pipelines protect the downstream data consumers — Power BI reports, scoring models or billing processes — from inconsistencies. When dashboards are used for financial decisions, an error repeated through reprocessings can translate into thousands of euros of impact. Idempotence reduces risk and makes safe automation possible, including replays and continuous deployments.

Essential principles for idempotent pipelines

There are four principles that guide any idempotent implementation: unique identification, deterministic deduplication, transactional writes and explicit state management. Unique identification means each source record has an identifier (for example, order_id + event_timestamp + source_batch_id) that allows distinguishing an event regardless of how many times it is delivered.

Deterministic deduplication uses that identifier to eliminate duplicates in a reproducible way. Transactional writes ensure that storage operations are atomic — for example, using MERGE operations on a Delta table. Explicit state management involves keeping control tables with offsets, watermarks or job_run_id to know how far processing has progressed and to avoid undesired reprocessing.

Practical implementation in Microsoft Fabric

In Microsoft Fabric, working with OneLake and Delta-style tables inside Lakehouses facilitates transactional guarantees. A recurring pattern we implement consists of: (1) raw ingestion to a staging area in OneLake; (2) transformation in a Spark Notebook/Job that produces a final Delta table; (3) use of MERGE to apply upserts; (4) updating a control table with the last offset and job_run_id.

In practice, a Spark Notebook in Fabric reads the staging file (parquet/avro/json), adds metadata columns (source_batch_id, processed_at, job_run_id) and writes to a Delta table with a MERGE operation. Fabric itself allows orchestrating this notebook via Pipelines, making controlled reruns simple and collecting execution logs for audit.

Write and state management strategies: MERGE, upsert and control tables

MERGE on Delta is the central tool: it allows, in a single operation, inserting new rows, updating existing ones and marking logical deletes if needed. Conceptual example of MERGE (pseudocode without formatting):

MERGE INTO bronze.orders AS target USING staging.batch_123 AS src ON target.order_id = src.order_id WHEN MATCHED AND src.event_ts > target.event_ts THEN UPDATE SET ... WHEN NOT MATCHED THEN INSERT ...

Additionally, we implement two layers of protection. First, a dedup step: after reading the batch, perform a dedup by (order_id, source_sequence) keeping the most recent version. Second, a control table with columns (pipeline_name, last_processed_offset, last_run_at, last_job_run_id, last_row_count). Before starting a batch, the job checks whether the source_batch_id has already been applied by consulting this table. This avoids repeated application in case of replays.

Testing, monitoring and regression automation

Idempotence requires evidence — not just best practices. We build a test suite that includes: unit tests for transformation scripts (with small datasets), integrations that rebuild a subset of the pipeline and reprocessing tests that run the same batch 3–5 times to validate that results remain identical. These tests run as part of the CI/CD pipeline.

Operational monitoring should include specific metrics: rate of detected duplicates, differences in row counts after reprocessing, time to complete MERGE and drops in throughput. Alerts for anomalies such as an increase from 0.1% to 1% in duplicate rate enable early intervention. We also automate a daily reconciliation job that checks unique keys in critical tables and sends reports to the data team and to business owners.

Idempotence is not just technical: it is an operational culture that turns risky reprocessings into predictable routines.

Mini case study: digital retail with 120 employees

In a digital retail company with 120 employees and 2 million daily clickstream events, the bConcepts team implemented idempotent pipelines in Fabric for event processing toward operational dashboards and recommendation models.

Before the intervention: manual reprocessings were common; a full reprocessing took 6 hours, consumed 80 compute units and generated duplicates in 4% of records, resulting in KPI report errors and duplicate leads for campaigns, with an estimated impact of €14k/month in marketing costs. After adopting the described patterns — ingestion to staging, adding source_batch_id and job_run_id, deterministic dedup and MERGE on Delta — reprocessing took 45 minutes (an 88% reduction), the cost per reprocessing fell to 12 compute units and the duplicate rate dropped below 0.02%.

Additional results: Power BI reports stopped showing unexpected variations between runs; the team reduced time spent on monthly reconciliations by 60%; and it became possible to automate alerts that, within two months, detected a source of events with incorrect timestamps, avoiding €7k of misdirected campaign costs.

In summary

  • Identify records with unique keys and add metadata (source_batch_id, job_run_id) to enable deterministic deduplication.
  • Use MERGE on Delta tables in Fabric and maintain control tables with offsets to avoid unwanted reapplications.
  • Automate reprocessing tests and monitor duplicate, count and latency metrics to ensure safe regression.
  • Design pipelines to be reentrant: treat each run as potentially repeated without extensive side effects.
  • Document and share patterns with analytics and product teams to align expectations about reprocessings and SLAs.

Implementing idempotence is not an academic exercise; it is a pragmatic measure that reduces operational costs, improves the confidence of data consumers and enables safe automation of operations that would otherwise require constant manual intervention.

Practical next steps we suggest: map the critical tables that support financial decisions, instrument control tables and job_run_id in existing pipelines, and add a reprocessing test to the continuous integration process. If you want, we can help design a three-phase plan — identification, safe change and validation — for your organization.

How do you plan to ensure that a reprocessing of your pipeline does not cause more problems than it solves?

← 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