Data Migration Factory | Datanest Digital | https://datanest.dev
This guide describes the end-to-end methodology for migrating data from
heterogeneous source systems into a Databricks Lakehouse using the Data
Migration Factory toolkit. The methodology is structured in six phases,
each with clear inputs, activities, deliverables, and exit criteria.
Phase 1 Phase 2 Phase 3 Phase 4 Phase 5 Phase 6
Discovery --> Assessment --> Development --> Execution --> Cutover --> Decommission
(1-2 wk) (1-2 wk) (2-4 wk) (2-6 wk) (1 day) (1-4 wk)
Establish the scope, identify all source systems, and align stakeholders on
migration goals, constraints, and success criteria.
1. Stakeholder interviews — Meet data owners, application teams, and
operations to understand current data flows and pain points.
2. Source system inventory — Document all databases, file stores, and
APIs that hold data to be migrated.
3. Dependency mapping — Identify upstream producers and downstream
consumers of each data source.
4. Constraint identification — Document maintenance windows, compliance
requirements, data residency rules, and SLAs.
5. Success criteria definition — Agree on measurable criteria: zero data
loss, max acceptable downtime, performance thresholds.
Catalog every table, measure volumes, evaluate complexity, and produce a
prioritised wave plan.
| Tool | Purpose |
|---|---|
assessment/source_assessment.py | Automated catalog of tables, columns, volumes, dependencies |
assessment/migration_wave_planner.py | Score and group tables into migration waves |
1. Automated assessment — Run source_assessment.py against each source
system. The notebook catalogs tables, column metadata, row counts, primary
keys, foreign keys, and timestamp column availability.
2. Complexity scoring — Each table receives a complexity score based on:
3. Wave planning — Run migration_wave_planner.py to group tables into
ordered waves. Parameters:
--max-tables-per-wave: Limit tables per batch (default: 20)--max-rows-per-wave: Limit total rows per batch (default: 500M)4. Manual review — Adjust wave assignments for business priority, testing
dependencies, or regulatory requirements.
| Wave | Contents | Rationale |
|---|---|---|
| Wave 1 | Small, simple reference tables (< 1M rows, no FKs) | Prove the pipeline, build team confidence |
| Wave 2 | Medium tables with primary keys and timestamps | Validate incremental patterns |
| Wave 3+ | Large, complex tables with dependencies | Requires proven patterns from earlier waves |
| Final | Lookup tables and rarely-changing dimensions | Low risk, migrate last |
migration.assessment.source_tables)migration.assessment.table_dependencies)Configure extractors, build target schemas, implement validation, and establish
operational tooling.
1. Target schema design
2. Extractor configuration
| Source Type | Extractor | Incremental Method |
|---|---|---|
| SQL Server | sql_server_extractor.py | Change Tracking or CDC |
| PostgreSQL | postgresql_extractor.py | Timestamp or Logical Replication |
| MySQL | mysql_extractor.py | Timestamp or Binlog/GTID |
| Oracle | oracle_extractor.py | SCN or LogMiner |
| Flat files | file_bulk_extractor.py | Auto Loader or Modified-Date |
| REST APIs | rest_api_extractor.py | Timestamp parameter |
partition columns for each table.
3. Validation setup
validation/reconciliation.py with source JDBC details andtarget table references.
validation/data_sampling.py for large-table spot checks.configurable for aggregates).
4. Dashboard deployment
dashboards/migration_progress.sql into Databricks SQL.pipeline health.
5. Testing
Execute migration waves sequentially, validate each wave before proceeding,
and establish incremental pipelines for ongoing sync.
For each wave:
1. Full load — Run the extractor with load_type = full for all tables
in the wave.
2. Row count validation — Run reconciliation with check_types = row_count.
3. Hash validation — Run reconciliation with check_types = hash on
tables with primary keys.
4. Aggregate validation — Run reconciliation with check_types = aggregate
on tables with numeric columns.
5. Sampling — Run data_sampling.py for large tables (>10M rows).
6. Review results — All checks must PASS before enabling incremental mode.
7. Enable incremental — Switch extractors to load_type = incremental_*
and schedule them (every 15-60 minutes depending on SLA).
8. Monitor — Watch the migration progress dashboard for 24 hours.
9. Sign off wave — Get stakeholder confirmation before starting the next wave.
| Issue | Detection | Remediation |
|---|---|---|
| Row count mismatch | Reconciliation FAIL | Check for filtered rows, soft deletes, or in-flight transactions |
| Hash mismatch | Hash check FAIL | Compare specific column values; check for encoding, precision, or timezone differences |
| Missing PKs in target | PK diff FAIL | Verify extraction query isn't filtering; check for NULLs in PK columns |
| Watermark not advancing | Stale pipeline alert | Check JDBC connectivity, source permissions, extractor logs |
| Schema mismatch | Extractor error | Run overwriteSchema = true for full load, or manually ALTER TABLE |
migration.reconciliation.reconciliation_resultsTransition production workloads from source to target with minimal downtime
and zero data loss.
See runbooks/cutover_runbook.md for the full step-by-step procedure.
1. Parallel run (48 hours) — Both systems active, continuous reconciliation.
2. Freeze source — Stop writes, run final sync.
3. Final validation — Full reconciliation, all checks PASS.
4. Switchover — Update connection strings, redirect consumers.
5. Confirmation — Monitor for 30 minutes, run smoke tests.
6. Rollback (if needed) — Revert connections, re-enable source.
Safely retire source systems after confirming the target is stable and complete.
See runbooks/decommissioning_checklist.md for the detailed checklist.
1. Complete hypercare period (minimum 7 days).
2. Disable source write access.
3. Take final backup and archive.
4. Disable source read access.
5. Decommission infrastructure.
6. Update documentation and close project.
1. Validate early and often. Run reconciliation after every extraction,
not just at the end.
2. Start simple, build confidence. Wave 1 should be small reference tables.
Prove the pattern before tackling large, complex tables.
3. Automate everything. Manual data movement introduces errors. Use the
extractor notebooks with parameterised widgets and schedule them via
Databricks Workflows.
4. Keep the rollback path open. Never decommission the source until the
hypercare period is complete and all stakeholders have signed off.
5. Document decisions. Record why tables were grouped into specific waves,
why certain extractors were chosen, and any deviations from the plan.
6. Monitor continuously. The migration progress dashboard should be the
team's primary view throughout the project. Stale pipelines and failed
reconciliation checks should trigger immediate investigation.
| Term | Definition |
|---|---|
| CDC | Change Data Capture — mechanism for detecting and capturing data changes |
| CT | Change Tracking — SQL Server feature for lightweight change detection |
| Full Load | Complete extraction of all rows from a source table |
| Hypercare | Post-cutover monitoring period with heightened alertness |
| Incremental Load | Extraction of only rows changed since the last watermark |
| LogMiner | Oracle utility for reading redo logs to capture DML changes |
| Reconciliation | Process of comparing source and target data for completeness and accuracy |
| SCN | System Change Number — Oracle's transaction ordering mechanism |
| Watermark | A saved position (timestamp, SCN, LSN) marking the last extracted point |
| Wave | A group of tables migrated together as a batch |
*Data Migration Factory | Datanest Digital | https://datanest.dev*