# rvkumar1398/adf-onprem-migration-project architecture

> Architecture diagram of the GitHub repository rvkumar1398/adf-onprem-migration-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rvkumar1398/adf-onprem-migration-project
- Repository: https://github.com/rvkumar1398/adf-onprem-migration-project

## Overview

#### Purpose and Deployment Model
This is Azure Data Factory (ADF) source control for a metadata-driven incremental migration from on-premises SQL Server to Azure Data Lake Storage Gen2 (ADLS Gen2). The factory definition is `factory/adfdevRwSAP.json`; ADF Git integration restores and publishes these artifacts.

#### Entry Point and Orchestration
`pipeline/MasterPipeline.json` is the operational entry point. It reads all tracked source-table records from the SQL watermark/control table, then iterates them with a ForEach. Each iteration invokes the reusable child pipeline with the table-specific schema, table name, watermark column, and prior load value.

The key control boundary is the watermark table `dbo.ADF_Watermark_Table`: it determines which tables are processed and provides each table’s incremental checkpoint.

#### Per-Table Incremental Load
`pipeline/PL_Child_Incremanta.json` executes one table load. It:
1. Retrieves the current maximum source watermark.
2. Compares that value with the control-table `LastLoadValue`.
3. Conditionally copies only rows beyond the prior watermark.
4. Calls `dbo.UpdateWatermark` after a successful copy.

This separates fleet-wide orchestration from table-level extraction and makes the child pipeline parameter-driven.

#### Source Access and Runtime Boundary
The source is on-premises SQL Server, represented by `linkedService/SqlServer2.json` (with another SQL linked-service artifact at `linkedService/SqlServer1.json`). Connectivity crosses the cloud/on-premises boundary through the self-hosted integration runtime in `integrationRuntime/integrationRuntime1.json`.

The runtime is architecturally required: ADF activities execute against the local SQL environment through it, while credentials and runtime registration must be supplied outside Git.

#### Dataset Contracts
`dataset/DS_LKUP_MAX_VALUE.json` is the parameterized SQL dataset used for per-table maximum-watermark lookup. `dataset/DS_ADLS_SINK_PARQUE.json` defines the parameterized Parquet sink target. These artifacts form the data contract between child-pipeline parameters and source/sink paths.

#### Lake Sink and Storage Services
Incremental rows land in the `rawdata` ADLS Gen2 container as Parquet, partitioned by table and date. `linkedService/LS_ADLS_Gen2.json` is the primary lake connection. Additional storage/REST artifacts exist in `linkedService/AzureDataLakeStorage.json`, `linkedService/LSAzureBlobStorage.json`, and `linkedService/LS_REST_PARQUTE.json`, but the documented migration path uses ADLS Gen2.

#### State, Reliability, and External Dependencies
The watermark update occurs only after the conditional copy path, preserving the intended “advance checkpoint after load” flow. Correctness depends on source watermark monotonicity, SQL stored procedure `dbo.UpdateWatermark`, the on-premises SQL control table, available self-hosted IR, and the ADLS account/container. Secrets are intentionally absent from repository artifacts and must be reconfigured when rebuilding.

Main entry points: [`pipeline/PL_Child_Incremanta.json`](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json) (Incremental Parquet copy), [`pipeline/MasterPipeline.json`](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/MasterPipeline.json) (Master pipeline), [`dataset/DS_LKUP_MAX_VALUE.json`](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/dataset/DS_LKUP_MAX_VALUE.json) (Max watermark dataset), [`linkedService/SqlServer2.json`](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/linkedService/SqlServer2.json) (SQL linked service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_adf["Azure Data Factory"]
  node_factory{{"ADF factory definition<br/>[adfdevRwSAP.json]"}}
  node_master["Master pipeline<br/>orchestration pipeline"]
  node_foreach["ForEach table records<br/>pipeline activity"]
  node_child["Incremental child pipeline<br/>parameterized pipeline"]
  node_maxlookup["Get current max watermark<br/>lookup activity"]
  node_maxdataset["Max watermark dataset<br/>parameterized SQL dataset"]
  node_compare["Compare checkpoints<br/>conditional activity"]
  node_copy["Incremental Parquet copy<br/>copy activity"]
  node_sqlservice["SQL linked service<br/>ADF linked service<br/>[SqlServer2.json]"]
  node_ir{{"Self-hosted integration runtime<br/>runtime boundary"}}
  node_sinkdataset["Parquet sink dataset<br/>parameterized ADLS dataset"]
  node_adlsservice["ADLS Gen2 linked service<br/>ADF linked service<br/>[LS_ADLS_Gen2.json]"]
end

subgraph group_onprem["On-premises SQL Server"]
  node_control[("Watermark control table<br/>SQL state table")]
  node_updateproc[("UpdateWatermark procedure<br/>SQL stored procedure")]
  node_sqlsource[("Source SQL tables<br/>SQL source")]
end

subgraph group_lake["ADLS Gen2"]
  node_rawdata[("rawdata Parquet landing<br/>ADLS Gen2 container")]
end

node_factory -->|"publishes"| node_master
node_master -->|"reads tracked tables"| node_control
node_master -->|"iterates"| node_foreach
node_foreach -->|"invokes with parameters"| node_child
node_child -->|"retrieves maximum"| node_maxlookup
node_maxlookup -->|"uses"| node_maxdataset
node_maxdataset -->|"connects through"| node_sqlservice
node_sqlservice -->|"uses"| node_ir
node_ir -->|"reaches on-premises"| node_sqlsource
node_maxlookup -->|"current value"| node_compare
node_control -->|"LastLoadValue"| node_compare
node_compare -->|"when new rows exist"| node_copy
node_sqlsource -->|"incremental rows"| node_copy
node_copy -->|"writes via"| node_sinkdataset
node_sinkdataset -->|"uses"| node_adlsservice
node_adlsservice -->|"lands Parquet"| node_rawdata
node_copy -->|"on success"| node_updateproc
node_updateproc -->|"updates checkpoint"| node_control

click node_factory "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/factory/adfdevRwSAP.json"
click node_master "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/MasterPipeline.json"
click node_foreach "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/MasterPipeline.json"
click node_child "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json"
click node_maxlookup "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json"
click node_maxdataset "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/dataset/DS_LKUP_MAX_VALUE.json"
click node_compare "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json"
click node_copy "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json"
click node_sqlservice "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/linkedService/SqlServer2.json"
click node_ir "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/integrationRuntime/integrationRuntime1.json"
click node_sinkdataset "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/dataset/DS_ADLS_SINK_PARQUE.json"
click node_adlsservice "https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/linkedService/LS_ADLS_Gen2.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_factory,node_master,node_foreach,node_child,node_maxlookup,node_maxdataset,node_compare,node_copy,node_sqlservice,node_ir,node_sinkdataset,node_adlsservice toneBlue
class node_control,node_updateproc,node_sqlsource toneAmber
class node_rawdata toneMint
```

## Components

### Azure Data Factory

- [ADF factory definition](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/factory/adfdevRwSAP.json): factory · Git-published factory definition. · `factory/adfdevRwSAP.json`
- [Master pipeline](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/MasterPipeline.json): orchestration pipeline · Operational fleet-wide entry point. · `pipeline/MasterPipeline.json`
- [ForEach table records](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/MasterPipeline.json): pipeline activity · Supplies per-table schema, name, watermark, and checkpoint. · `pipeline/MasterPipeline.json`
- [Incremental child pipeline](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json): parameterized pipeline · Executes one table incremental load. · `pipeline/PL_Child_Incremanta.json`
- [Get current max watermark](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json): lookup activity · `pipeline/PL_Child_Incremanta.json`
- [Max watermark dataset](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/dataset/DS_LKUP_MAX_VALUE.json): parameterized SQL dataset · `dataset/DS_LKUP_MAX_VALUE.json`
- [Compare checkpoints](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json): conditional activity · Copies only when source data exceeds LastLoadValue. · `pipeline/PL_Child_Incremanta.json`
- [Incremental Parquet copy](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/pipeline/PL_Child_Incremanta.json): copy activity · Extracts rows beyond the prior watermark. · `pipeline/PL_Child_Incremanta.json`
- [SQL linked service](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/linkedService/SqlServer2.json): ADF linked service · `linkedService/SqlServer2.json`
- [Self-hosted integration runtime](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/integrationRuntime/integrationRuntime1.json): runtime boundary · Provides ADF access to local SQL Server. · `integrationRuntime/integrationRuntime1.json`
- [Parquet sink dataset](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/dataset/DS_ADLS_SINK_PARQUE.json): parameterized ADLS dataset · `dataset/DS_ADLS_SINK_PARQUE.json`
- [ADLS Gen2 linked service](https://github.com/rvkumar1398/adf-onprem-migration-project/blob/main/linkedService/LS_ADLS_Gen2.json): ADF linked service · `linkedService/LS_ADLS_Gen2.json`

### On-premises SQL Server

- **Watermark control table**: SQL state table · Tracks enabled tables and prior load values.
- **UpdateWatermark procedure**: SQL stored procedure · Advances the checkpoint only after a successful copy.
- **Source SQL tables**: SQL source · Business tables selected by metadata.

### ADLS Gen2

- **rawdata Parquet landing**: ADLS Gen2 container · Partitioned by table and date.

## Connections

- ADF factory definition → Master pipeline: publishes
- Master pipeline → Watermark control table: reads tracked tables
- Master pipeline → ForEach table records: iterates
- ForEach table records → Incremental child pipeline: invokes with parameters
- Incremental child pipeline → Get current max watermark: retrieves maximum
- Get current max watermark → Max watermark dataset: uses
- Max watermark dataset → SQL linked service: connects through
- SQL linked service → Self-hosted integration runtime: uses
- Self-hosted integration runtime → Source SQL tables: reaches on-premises
- Get current max watermark → Compare checkpoints: current value
- Watermark control table → Compare checkpoints: LastLoadValue
- Compare checkpoints → Incremental Parquet copy: when new rows exist
- Source SQL tables → Incremental Parquet copy: incremental rows
- Incremental Parquet copy → Parquet sink dataset: writes via
- Parquet sink dataset → ADLS Gen2 linked service: uses
- ADLS Gen2 linked service → rawdata Parquet landing: lands Parquet
- Incremental Parquet copy → UpdateWatermark procedure: on success
- UpdateWatermark procedure → Watermark control table: updates checkpoint
