On Dec 4, 2012, at 3:04 PM, Jason wrote:

> After upgrading to SQLAlchemy 0.7.9 I know receive an error  "FlushError: 
> Over 100 subsequent flushes have occurred within session.commit() - is an 
> after_flush() hook creating new objects?" which is was introduced by 
> http://docs.sqlalchemy.org/en/latest/changelog/changelog_07.html#change-75a53327aac5791fe98ec087706a2821
>  in the changelog. 
> 
> I don't have any after_flush event handlers.  I do have a before_flush event 
> handler that changes the state of a related object, but that doesn't sound 
> like what the error is talking about.
> 
> How can I debug this further? I am doing this within a Pyramid application, 
> so I am somewhat removed from the commit logic.

this error traps the condition that dirty state remains in the Session after a 
flush has completed.    This is possible if an after_flush hook has added new 
state, or perhaps also if a mapper.after_update/after_insert etc hook, or even 
a before_update/before_insert has modified the flush plan, which is not 
appropriate in any case.

the best way is to actually create an after_flush() hook with a 
"pdb.set_trace()" in it; in there, you'd just look at session.new, 
session.dirty, and session.deleted to ensure that they are empty.


-- 
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