Hi,
A little update; this code handles the case where columns have a key
attribute:
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():
print tbl
mismatch = {}
for col in tbl.c:
if col.key != col.name:
mismatch[col.name] = col.key
def rewrite(x, mismatch):
x = dict(x)
for m in mismatch:
x[mismatch[m]] = x[m]
return x
deng.execute(tbl.insert(), [rewrite(x, mismatch) for x in
seng.execute(tbl.select())])
Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---