Hi there,

I'm looking into a reliable way to clone ORM-mapped instances, so that 
the clone, with some modifications, can be re-added to the database. I 
saw the following thread:
 
http://groups.google.com/group/sqlalchemy/browse_thread/thread/6e162f9a74697a01/6396c677b2a87797#6396c677b2a87797

Unfortunately the solutions presented in this thread require the 
instantation of the class without arguments, and this is not something 
that works with arbitrary classes as an __init__ may have required 
arguments.

I went with a solution that instead clones the record on the table 
level, going outside the ORM. I'd be nice though if there were an easy 
way to do this with the ORM. Would this be something that be sensible to 
add to SQLAlchemy itself? What would the implementation strategy be?

Of course once one starts thinking about relations and the like, cloning 
can get pretty hairy. Perhaps for that reason the cloning of an instance 
doesn't have a general implementation in SQLAlchemy. You'd need to clone 
everything that relates to it as well, and that can get pretty involved. 
(I'd need such a thing though, as my use case involves items going 
through a workflow. each of the indirect "deep-copy" clones would 
require a modification as well)

Regards,

Martijn


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

Reply via email to