oh, I know what you're doing, you're modifying the attributes of objects that 
aren't even involved - so yes, the flush normally doesn't go finding those, and 
set_committed_value() would be your workaround for now.

However, I can modify flush to do this "reset" for everything that's in 
"dirty", rather than just what it knows to have changed.    I'd have to think 
about this as I'm not sure it's appropriate.



On Oct 2, 2012, at 4:28 PM, Mark Friedenbach wrote:

> Indeed, session.dirty is non-empty within after_flush_postexec().
> 
> I'm working on a fix for sqlalchemy-orm-tree first before I can think about 
> doing a (smaller) regression test. Besides, it now occurs to me that in some 
> cases I might be setting attributes on objects in the session but outside of 
> the flush plan (child nodes of a parent that gets moved around, for example). 
> That could legitimately cause an undesired 2nd flush. `set_committed_value` 
> looks like what I want to fix that.
> 
> On Tue, Oct 2, 2012 at 1:08 PM, Michael Bayer <mike...@zzzcomputing.com> 
> wrote:
> 
> On Oct 2, 2012, at 4:05 PM, Michael Bayer wrote:
> 
> >    In theory it would be only .new and .dirty that might have state after 
> > the flush completes.
> 
> correction, ".new and .deleted" lists that might have any state.
> 
> 
> --
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 
> 
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to