On 8/5/2010 11:03 AM, Michael Bayer wrote:
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.
Thank you.
Michael
--
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.