Skip to content


Let's add my changes from "The Great WL Data Migration of 2012" #2

merged 1 commit into from

2 participants


No description provided.

@shazow shazow merged commit a8c838b into shazow:master

You're awesome, thanks for making my life easier. :)


Awesome! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 15, 2012
  1. @jewelia
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 4 deletions.
  1. +5 −4 sqlalchemygrate/
9 sqlalchemygrate/
@@ -53,14 +53,15 @@ def table_migrate(e1, e2, table, table2=None, convert_fn=None, limit=100000):
if convert_fn:
r = []
for row in data:
- converted = convert_fn(table, row)
+ converted = convert_fn(row=row, old_table=table, new_table=table2)
if isinstance(converted, types.GeneratorType):
r += list(converted)
- else:
+ elif converted is not None:
data = r
- e2.execute(table2.insert(), data).close()
+ if data:
+ e2.execute(table2.insert(), data).close()
log.debug("-> Inserted {0} rows into: {1}".format(len(data),
@@ -150,7 +151,7 @@ def migrate(e1, e2, metadata, convert_map=None, populate_fn=None, only_tables=No
if callable(populate_fn):"Running populate function.")
- populate_fn(metadata_from=metadata_old, metadata_to=metadata)
+ populate_fn(metadata_from=metadata_old, metadata_to=metadata_new)
for table in metadata_old.sorted_tables:
table_name =
Something went wrong with that request. Please try again.