On Aug 5, 2010, at 11:54 AM, Michael Hipp wrote: > Can this be made to work? > > session = Session() > rec = MyModel() # create a record > session.close() > > # Sometime later > session = Session() > rec.name = "Fred" # modify the record > session.commit() # try to save modified record > session.close() > > Does the session have to be "global" to this whole operation? Is there a way > to issue the 'commit' on the record instead of the session?
make sure you give a good read through http://www.sqlalchemy.org/docs/session.html . What you would like here is to make a "detached" object "persistent" again. add() and merge() both accomplish that end result though with different ramifications regarding pre-existing state. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.