Skip to content

Instantly share code, notes, and snippets.

@buxx
Created October 25, 2019 08:06
Show Gist options
  • Save buxx/1e552aa80053570d4cf72cb445996780 to your computer and use it in GitHub Desktop.
Save buxx/1e552aa80053570d4cf72cb445996780 to your computer and use it in GitHub Desktop.
src = create_engine('mysql+oursql://username:[email protected]:3306/dbname')
dst = create_engine('postgresql://username:password@localhost:5432/dbname')
tables = Base.metadata.tables;
for tbl in tables:
data = src.execute(tables[tbl].select()).fetchall()
for a in data: print(a)
if data:
print (tables[tbl].insert())
dst.execute( tables[tbl].insert(), data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment