[sqlalchemy] Re: Sqlalchemy 0.7.6 and mappers _save_obj methods.

2012-04-16 Thread rdunklau
I followed your suggestions, and implemented it in the following way: - a SessionListener class, responsible for maintaining the alternate state of the sesssion is instantiated. The class defines a before_flush, and after_flush methods, which are registered as event listeners for their respecting

Re: [sqlalchemy] Re: Sqlalchemy 0.7.6 and mappers _save_obj methods.

2012-04-16 Thread Michael Bayer
OK the one area that I'd check on is how exactly you remove items from new/deleted. The public API for that is pretty much to expunge() the object from the Session (I think expiring an object should remove from deleted also but I'd have to check).The use case of modifying those lists

[sqlalchemy] Re: Sqlalchemy 0.7.6 and mappers _save_obj methods.

2012-04-16 Thread rdunklau
On Apr 16, 4:16 pm, Michael Bayer mike...@zzzcomputing.com wrote: OK the one area that I'd check on is how exactly you remove items from new/deleted.   The public API for that is pretty much to expunge() the object from the Session (I think expiring an object should remove from deleted also

Re: [sqlalchemy] Re: Sqlalchemy 0.7.6 and mappers _save_obj methods.

2012-04-16 Thread Michael Bayer
so I think the safer options here would be: 1. for obj in session.new, use session.expunge(obj) 2. for obj in session.deleted, use session.add(obj) so #1, the difference is that it removes from _new and also detaches the state from the session, which just means it removes the session_id. you

[sqlalchemy] Re: Sqlalchemy 0.7.6 and mappers _save_obj methods.

2012-04-13 Thread rdunklau
On Apr 13, 3:12 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Apr 13, 2012, at 6:08 AM, Ronan Dunklau wrote: Hello. Prior to sqlalchemy 0.7.6, we implemented our own mappers to override the _save_obj and _delete_obj methods. that's very interesting.  There is an old ticket to