Skip to content
Community Question

How can Azure Data Factory be used to implement incremental data movement between enterprise data sources?

Share knowledge. Learn from experts. Build together.

Question

Enterprise data pipelines often need to move only new or modified records instead of repeatedly processing entire datasets. Azure Data Factory supports incremental data movement using approaches such as watermark columns, change tracking, timestamps, and metadata-driven pipelines. The challenge is designing a process that remains accurate when records are updated, deleted, or arrive late. How can developers and data engineers design incremental pipelines that are efficient, restartable, scalable, and reliable for real-world enterprise workloads?
159 Views Community Discussion

Answers

Implementing incremental data movement in Azure Data Factory (ADF) requires more than simply filtering records using a timestamp. In enterprise environments, the real challenge is ensuring that only new or modified records are processed while maintaining data consistency, handling late-arriving data, managing deletions and supporting reliable pipeline recovery.

A well-designed incremental data pipeline should be restartable, idempotent, scalable and capable of handling failures without processing the entire dataset again.

Here is how I would approach this architecture.

1. Implement Watermark-Based Incremental Extraction

One of the commonly used approaches is watermark-based incremental loading.

A watermark represents the last successfully processed position in the source system, usually based on a modification timestamp or an increasing sequence number.

For example, consider a customer table containing:

  • CustomerId

  • CustomerName

  • Email

  • ModifiedDate

Instead of extracting the complete table every time, ADF retrieves records modified after the previous successful watermark.

Example SQL query:

SELECT
    CustomerId,
    CustomerName,
    Email,
    ModifiedDate
FROM dbo.Customers
WHERE ModifiedDate > @LastWatermark
  AND ModifiedDate <= @CurrentWatermark;

Here, LastWatermark represents the previous successful extraction point, while CurrentWatermark represents the upper boundary captured for the current pipeline execution.

Maintaining both boundaries helps prevent records arriving during pipeline execution from being unintentionally included in an inconsistent extraction window.

2. Maintain a Watermark Control Table

For enterprise implementations, I recommend maintaining a control table rather than hardcoding timestamps inside pipeline activities.

Example:

CREATE TABLE ETL_Watermark
(
    PipelineName VARCHAR(200),
    LastWatermark DATETIME2,
    LastRunStatus VARCHAR(50),
    LastUpdated DATETIME2
);

ADF can use the following activities:

  1. Lookup – Retrieve the previous watermark.

  2. Lookup – Capture the current source boundary.

  3. Copy Data – Extract records within the selected range.

  4. Stored Procedure – Perform target-side upsert or merge.

  5. Stored Procedure – Update the watermark after successful processing.

Important: Advance the watermark only after the corresponding data has been successfully committed to the target. Otherwise, a failed pipeline could permanently skip records.

3. Handle Inserts, Updates and Deletes

A timestamp-based approach can identify new and modified records only when the source reliably updates the modification timestamp.

However, physical deletions create another challenge.

If a customer record is deleted from the source, a normal incremental query cannot retrieve that deleted record.

For this reason, enterprise pipelines should consider:

  • Change Data Capture (CDC).

  • Database change tracking.

  • Soft-delete flags.

  • Source audit tables.

  • Transaction logs or equivalent change feeds.

For example, a soft-delete implementation might expose:

SELECT
    CustomerId,
    CustomerName,
    IsDeleted,
    ModifiedDate
FROM dbo.Customers
WHERE ModifiedDate > @LastWatermark
  AND ModifiedDate <= @CurrentWatermark;

The target system can then apply inserts, updates and deletions according to the incoming change information.

The choice between watermark extraction and CDC depends on source capabilities, deletion requirements, transaction volume and latency expectations.

4. Design the Target Load for Idempotency

A common production problem occurs when a pipeline fails after copying data but before updating its control table.

When the pipeline is restarted, the same records may be processed again.

To avoid duplicate records, the target should support idempotent processing.

A typical approach is:

  • Copy extracted records into a staging table.

  • Validate the incoming dataset.

  • Perform an upsert using the business key.

  • Apply deletion information where available.

  • Commit the target transaction.

  • Update the watermark only after successful completion.

For example, SQL Server MERGE or an equivalent controlled INSERT/UPDATE strategy can be used to synchronize source changes with the target.

However, MERGE should be implemented with appropriate concurrency handling, unique constraints and transaction management. It should not be treated as an automatic guarantee of correctness.

5. Handle Late-Arriving and Out-of-Order Records

Enterprise source systems do not always update records in a perfectly sequential manner.

A record may arrive late, or its timestamp may be older than the latest watermark.

A practical solution is to use an overlapping extraction window where appropriate.

For example:

If the last watermark is 10:00 AM, the next extraction may start from 9:55 AM.

The target's idempotent upsert logic prevents duplicate records.

The overlap duration should be based on actual source-system behavior and must be combined with reliable change identification. It cannot recover changes that the source does not expose.

6. Build a Metadata-Driven Pipeline

When an organization has hundreds of tables, creating an individual ADF pipeline for every table becomes difficult to maintain.

Instead, build a reusable metadata-driven architecture.

Maintain configuration such as:

MetadataPurpose
SourceTableSource table name
TargetTableDestination table
WatermarkColumnIncremental tracking column
PrimaryKeyBusiness record identifier
LoadTypeFull or incremental
LastWatermarkPrevious successful boundary
IsActivePipeline execution control

ADF can use Lookup and ForEach activities to read this metadata and execute reusable Copy Data operations.

This reduces pipeline duplication and makes enterprise onboarding easier.

7. Monitor, Recover and Optimize

A production-grade pipeline should also include:

  • Pipeline execution monitoring.

  • Retry policies for transient failures.

  • Error logging and failed-record handling.

  • Batch processing and parallel execution where appropriate.

  • Source and target reconciliation.

  • Alerts for pipeline failures.

  • Performance monitoring and throughput analysis.

Pay particular attention to concurrent pipeline executions. Two runs processing the same watermark range can create duplicate work or update the control table incorrectly unless execution is coordinated.

Recommended Enterprise Architecture

Source Systems → ADF Incremental Extraction → Staging Layer → Data Validation → Upsert / Delete Processing → Target Data Platform → Watermark Update → Monitoring


Your Answer

Connect