From Mapping to Apache Hop: The Entire Migration Generated Automatically

Migrating data from one system to another has always been the kind of project where the hard part doesn't show up on the schedule: the loading order that respects foreign keys, the customer that exists in both databases, the category that was text and needs to become a table, the verification that proves nothing was lost. Writing all of this by hand, pipeline by pipeline, takes weeks.

In Pull Schema, this became a button. From the mapping between two models, it generates the complete Apache Hop project for the migration — pipelines, workflow, connections, verification queries, and a README that explains the rationale behind each step.

A story that begins with Kettle

Before becoming Apache Hop, this tool was called Kettle — created by Matt Casters and later known as Pentaho Data Integration. It was with it that e-Setorial carried out a large part of its migrations, and it was one of these projects that became an article in SQL Magazine issue 106: Migração de dados utilizando Pentaho Data Integration. In 2017, at Pentaho Day in Curitiba, we had the chance to meet Matt in person. Today, Kettle has evolved into Apache Hop, an Apache Software Foundation project — and it remains our choice for moving data.

The technique from that article is the same one that Pull Schema applies now, only generated: you describe what becomes what, and the rest is derived from the model.

What comes out of the button

For the case featured in the demo — the merger of two stores, with the source system in SQL Server and the target in MySQL —, the kit has 20 files:

  • 8 Apache Hop pipelines, one per step, already in the correct load order;
  • a workflow that chains them all together and stops at the first failure;
  • the source and target connections, with options that avoid each database's silent traps (booleans, date and time, quotes);
  • the SQL scripts for traceability, initial and final verification, extraction, delta, and pre-flight;
  • the README, which explains every decision — because the person running the migration is not necessarily the one who designed it.

The decisions the kit makes for you

The load order comes from the target's foreign keys. That is where integrity is verified, so that is where the order is calculated. With the target live, disabling a foreign key affects everyone — and the application could write an orphan record during that open window. That is why integrity is never disabled.

The migration can be paused and resumed. Each migrated row is flagged in the source, and extraction reads only what hasn't been migrated yet. Did the network drop halfway through? Run it again without duplicating anything.

The same customer across both companies becomes one. The pipeline deduplicates using the business key, asks the target if the row already exists, and, if it does, reuses it instead of creating another — recording back in the source what the case was.

The foreign key arrives already resolved. In the 2012 article, each row queried the target to find the parent ID. Now the extraction performs a JOIN, and the row already brings the target ID: fewer round trips, more speed.

In the end, the verification proves it. The kit compares the row count and the sum of the value columns on both sides. In the demo case, run on Apache Hop 2.18.1, the 8 pipelines finished in 20 seconds, and the verification balanced to the penny: $0.00 difference.

Tested with real Hop

None of this is theory. In addition to the demo case, the database switch kit ran on a model with 148 tables, 1,682 columns, and 240 foreign keys, from MySQL to PostgreSQL: Hop finished without errors, and the count matched table by table. And the hot migration was also executed on that same pair of databases. Every issue that only real execution reveals — a data type that only exists in one database, an index with a duplicate name, the boolean that one database writes as Y/N and the other rejects — became a fix in the generator, so it won't resurface in anyone's project.

Two kits, two problems

  • Switching databases, with the same structure on both sides: the model changes dialects, the target DDL comes ready, and the kit carries the data along. See how it works.
  • Migrating systems, with different structures: the mapping between the two models generates the hot migration described here. Read the step-by-step guide.

The migration kit is part of Pull Schema's paid plans; the demo shows the complete case, no registration required.

And when the project is bigger than a tool

Generating the kit handles the mechanical part. Deciding the mapping for a system with decades of data, negotiating the cutover window, and ensuring that nothing gets lost remains human work — and that is what e-Setorial has been doing since 1995. Discover our data migration service or talk to us.

Apache Hop is a project of the Apache Software Foundation, under the Apache License 2.0. Pull Schema generates files in Hop format and is not affiliated with or endorsed by the Apache Software Foundation.