Using an object-relational mapper to convert between databases

Ben Sizer kylotan at gmail.com
Wed May 28 10:26:54 EDT 2008


Hello,

I'd like to be able to do the following:

 - open a connection to a MySQL or PostgreSQL database
 - read the schema and contents for one or more tables
 - create a new sqlite database file and open a connection to it
 - write out the previously-read tables and their contents to this new
database

I get the impression that the various object-relational mappers such
as SQLAlchemy and SQLObject can make this easier, especially if using
something like SQLAlchemy's autoloading capability to query the schema
from the DB rather than me having to explicitly specify it. But then
how easy is it to make a corresponding sqlite table and write the same
objects to it? I don't know how practical this is with SQLAlchemy, or
if a different ORM library would be more useful for this. And since
objects tend to be closely related to the database they are mapped to,
I don't know how easy it is to reflect them onto a second database.

I'd just like some advice and pointers from anybody who's tried
something similar to this or who knows the packages well enough to
point me in the right direction.

--
Ben Sizer



More information about the Python-list mailing list