Does this mean there is a limit to the number of queries I can run in a transaction?
For example I am looping about 20 times. For each loop I insert one or two rows and do at least one query. There might be some more implicit queries when accessing relationship properties. If I set Session.autoflush to false before the loop and then set it back to true afterwards it works. On Tuesday, December 4, 2012 3:16:24 PM UTC-5, Michael Bayer wrote: > > > 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-75a53327aac5791fe98ec087706a2821in > 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 view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/vKM3a0cwCY8J. 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.
