how to migrate database data from sqlite to mysql?

751 views
Skip to first unread message

junepeach

unread,
Dec 8, 2012, 8:41:23 PM12/8/12
to sqlal...@googlegroups.com
I am looking for an efficient way to migrate all of the data in sqlite DB to mysql DB using sqlalchemy. Does anybody here know about it. I really appreciate if you can post your testing code in this forum. I searched online and found this link: http://www.tylerlesmann.com/2009/apr/27/copying-databases-across-platforms-sqlalchemy/ , however I don't know why it didn't work for me. I am sure there are some other languages which can do a nice job too, but I would like to use sqlalchemy which I am very interested in learning.

Thanks a lot and best regards!

JP

Chris Abiad

unread,
Dec 9, 2012, 12:57:01 PM12/9/12
to sqlal...@googlegroups.com
Hi JP,

I haven't tried migrating between databases before, but I took a quick look at the link you provided. The basic concept, of using SQLAlchemy's support for each database to read and write a table at a time with separate connections and sessions, seems reasonable as long as your table contents are on the smaller side.

Before anything else, I recommend going through the tutorial (http://docs.sqlalchemy.org/en/rel_0_7/orm/tutorial.html) and verifying that your arguments to create_engine() allow you to query data from your sqlite database to be migrated and create tables and add rows to the mysql database you wish to migrate to.

After that, if you still have issues migrating, try to let us know as much as possible about what happened. What parts of the process didn't work? Did you get any error messages?

All the best,
Chris
Reply all
Reply to author
Forward
0 new messages