I'm trying to make a small utility that uses a larger application's ORM to
copy an object from one database (dev) to another (qa) for testing purposes.
But I'm running in to trouble getting SQLAlchemy to use the multiple
database connections.  I can get the object to load, and then open a
connection to the other database, but when I try to call save, I get the
following error:

        sqlalchemy.exceptions.InvalidRequestError: Instance
'<thig.base.model.policy.Policy object at 0x018C5AB0>' is a detached
instance or is already persistent in a different Session

Is it possible to re-attach an ORM instance to a new session in order to
duplicate the data to another database like I'm doing?  If so, how do I go
about that?

Additionally, as I suspect this will be a problem once I get it re-attached,
is there an easy way to specify that all properties, recursively, should be
eager loaded?

For reference, my code is attached.

Thanks!

Cory Johns
Systems
Tower Hill Insurance Group, Inc.

 <<policycopy.py>> 




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Attachment: policycopy.py
Description: Binary data

Reply via email to