SQLite, MySQLdb to open .db file conceptual Python process

2.1k views Asked by At

I have a db file that I would like to open, process the data within and re-save as another db file to be inserted into a MySQLdb database. I have read that the only way to open a db file is with SQLlite. I'm working in Ubuntu 11.04. I need to write the process code in Python. What is the correct conceptual procedure to do this?

1

There are 1 answers

0
danodonovan On

I would recommend sqlalchemy for this type of problem. You can use it to

  1. Open your SQLite3 DB and figure out the schema
  2. Save that schema as a sqlalchemy model
  3. < OPTIONAL do any processing you like >
  4. Using the same sqlalchemy model from 1, open a MySQL connection, create the tables and load the data

Note I - you can do all this with the django ORM too - but the SQLAlchemy route will allow you to have less redundant code and more future flexibility.

Note II - sqlautocode can help you with 1.