philipsoutham/py-mysql2pgsql — pull request #5 by anentropic (2012-01-10 17:00:35+00:00)
Title: Load data into tables in order given by only_tables yaml value

When migrating data-only into an existing postgresql db it is useful to be able to control the order in which tables are loaded, because one table may have foreign key constraints that mean you have to load rows from another table first.

Currently tables are loaded in, I think, alphabetical order as provided by the mysql EXPLAIN query.

I made a small hack to allow tables to be loaded in the order you specify in the `only_tables` config value. This allowed me to successfully migrate data-only for a Django site with many fk constraints (by trial and error shuffling the order around until there were no errors...)