Hi, >I'm in the same process, and very interested in the answer ! > > I've found what I think is the best solution, and it sounds quite obvious thinking about it. Define the table, do a select on the old database and an insert on the new database. This leverages all SQLAlchemy's cleverness in converting types, etc. and keeps the ORM out of the picture. The code I'm using is:
model = __import__(sys.argv[1]) if sys.argv[2] == 'copy': seng = create_engine(sys.argv[3]) deng = create_engine(sys.argv[4]) for tbl in model.metadata.table_iterator(): deng.execute(tbl.insert(), [dict(x) for x in seng.execute(tbl.select())]) All it relies on is that you call your MetaData "metadata". At the moment, it chokes on names that contain a dash (or maybe it's ones that use key=), but I'm sure I can workaround that. When I'm done, I'll put this up as a recipe. Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---