copy.copy() is going to have issues since you'd be copying the _sa_state of the instance as well. "copying" an object that is SQLA mapped implies a particular use case in mind, depending on this use case is what would determine how you get your "copy".
Would you like to get a "copy" that is simply the same object with the same identity, just as present in another session (in which case use merge()) ? Or would you like to get a "copy" that is a transient (no database identity) copy of that object, with all attributes except primary key attributes copied over ? ( in which case you'd use a copy constructor which possibly uses mapping metadata to traverse ) ? On Sep 9, 2008, at 2:16 PM, [EMAIL PROTECTED] wrote: > > u can try: > from copy import copy > dest = copy(src) > it has pickle semantics, YMMV - i have not tried on SA objects. > i use my own, see my post in this thread with some (complex) code: > http://groups.google.com/group/sqlalchemy/tree/browse_frm/thread/2369b78e0f8e21cb/4dd4979ca8501fba > > On Tuesday 09 September 2008 18:59:09 picoplex wrote: >> Is there a quick way to copy an object (including all its >> relationships as well as its attributes)? >> >> Regards, >> >> Tim >> > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---