[sqlalchemy] offending objects removed from session

2009-10-18 Thread Brett
I just came across this issue where if an IntegrityError is raised on session.commit() then the offending object that caused the error is automatically removed from the session. If the object is a child object is related to parent object and the child object is in session.new then it is removed

[sqlalchemy] Re: offending objects removed from session

2009-10-18 Thread Michael Bayer
On Oct 18, 2009, at 3:24 PM, Brett wrote: I just came across this issue where if an IntegrityError is raised on session.commit() then the offending object that caused the error is automatically removed from the session. its removed when you say rollback().any pending add()s are

[sqlalchemy] Re: offending objects removed from session

2009-10-18 Thread Brett
As always, thanks for the excellent and thorough response. It does seem that if the offending object is in session.new when the commit() fails it is removed from the session without me doing a rollback(). e.g: u = User() session.add(u) session.commit() (IntegrityError) user.name may not be NULL

[sqlalchemy] Re: offending objects removed from session

2009-10-18 Thread Michael Bayer
On Oct 18, 2009, at 5:43 PM, Brett wrote: As always, thanks for the excellent and thorough response. It does seem that if the offending object is in session.new when the commit() fails it is removed from the session without me doing a rollback(). e.g: u = User() session.add(u)