Partition related source records
A configured relationship graph lets DuckDB plan Customer-rooted batches. Related files stay grouped, and each batch receives its own raw inputs.
prepare_root_batches.py
Client implementation / Python · Salesforce
Designed for reuse across client projects, the framework uses CSV as its input contract and keeps source relationships, field mappings, and destination connectors at clear boundaries. This implementation uses SAP Commerce exports and Salesforce; other destination APIs require their own connector.
Client and environment identifiers are omitted. The pipeline starts from exported files; it does not connect to a live SAP instance.
01 / Architecture
A direct run or a prepared batch enters the same validated, run-scoped pipeline.
A configured relationship graph lets DuckDB plan Customer-rooted batches. Related files stay grouped, and each batch receives its own raw inputs.
prepare_root_batches.py
A run launcher creates one run-scoped raw directory for the supplied CSV files.
start_migration_run.ps1
Both preparation paths converge at registry validation
A unique migration_run_id scopes inputs, intermediate
data, loader evidence, reports, and the Salesforce
MigrationRunId__c field.
Source schemas, relationship rules, field mappings, and run settings are configured per migration wherever possible, rather than embedded in the shared processing stages.
SAP Commerce is the source in this implementation, not a required live dependency. Another source can use the same pipeline when its CSV files are described by the relevant schemas, relationships, and mappings.
The current connector loads Salesforce-shaped CSVs through Bulk API 2.0. A connector for another platform could consume target-shaped CSVs and translate records into that platform’s API requests.
Scope: Salesforce is the implemented destination here. Each additional platform would need its own connector, authentication, mappings, error handling, and verification.
02 / Run lifecycle
Inputs, outputs, and control points are visible from profiling through sign-off.
Inspect schemas, row counts, nulls, duplicates, delimiters, and file volume to establish a data-quality baseline.
Create a canonical run root and carry the same identifier through each stage and into target records.
Validate the relationship graph and split Customer-rooted records into restartable batches; standalone file graphs get independent roots.
Reconstruct links across flat files, scope child data, and record missing, orphaned, or ambiguous relationships.
Combine resolved and required raw files under
transform_input/ so transformation receives a
stable, explicit input contract.
Normalize fields, convert types, and apply configured filters and rules to produce target-shaped object CSVs. In this use case, the target schema is Salesforce.
The current Salesforce connector validates the object plan before creating asynchronous Bulk API 2.0 jobs, then retains job state and row-level results.
Compare local evidence and optional read-only Salesforce checks. Complete, partial, and inconclusive results remain distinct.
03 / Operational design
Registries, relationship graphs, source maps, field mappings, loader metadata, and reconciliation rules are configured independently.
PowerShell wrappers coordinate run-root-scoped Python entry points and expose operational parameters.
Python modules handle profiling, batching, relationship resolution, transformation, loading, results, reporting, and rollback.
Canonical folders and JSON/CSV artifacts keep stage outputs, recovery state, result files, metrics, and reports available for analysis.
data/runs/<env>/<load-mode>/<migration-run-id>/
raw/
working/
transform_input/
transform_output/
bulk2/
reports/
04 / Recovery and verification
Recovery, rollback, and reconciliation have different purposes and consequences.
Missing or unexpected files, invalid mappings, unknown object keys, bad registry configuration, and missing delta External IDs fail before authentication or job creation.
Recovery manifests and chunks support safe resumption while preserving accepted, failed, and unprocessed results for review.
Rollback is a separate Bulk API delete workflow. It is not an automatic side effect of recovery or reconciliation.
An inconclusive required reconciliation check is not eligible for sign-off; the report surfaces the evidence gap.
05 / Scope
The pipeline starts from SAP Commerce CSV exports. It does not extract data from or connect to a live SAP system.
Local checks and optional Salesforce SOQL queries inspect outcomes; they do not modify Salesforce records.
Private keys and local authentication profiles remain outside source control.
Prepared roots, loader results, recovery state, and reports remain associated with their migration run.
The result is not just a way to load records. It is a controlled migration that can be explained, resumed, challenged, and signed off using durable evidence.
Featured engineering