I've run into an interesting problem. A legacy bit of code basically does this:
sess = session_factory() while stuff_to_do: sess.begin() sometimes_add_stuff_to_sess() if some_condition: sess.rollback() continue other_stuff_here() sess.commit() I was getting this error: File "/path/to/the/code.py", line 134, in update_database sess.commit() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 789, in commit self.transaction.commit() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 401, in commit self._remove_snapshot() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 303, in _remove_snapshot for s in self._deleted: File "/usr/lib64/python2.6/weakref.py", line 303, in iterkeys for wr in self.data.iterkeys(): RuntimeError: dictionary changed size during iter If I add a sess.close() right before the sess.rollback() then I'm good-to-go. Is this expected? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.