SQLAlchemy 5.4.p1 - RuntimeError - why?

9 views
Skip to first unread message

Hermann Himmelbauer

unread,
Nov 24, 2009, 4:00:35 PM11/24/09
to sqlal...@googlegroups.com
Hi,
I'm experiencing some interesting error here with SQLAlchemy:
When I execute one of my functions, which do a simple session.query, the
following traceback occurs, but only sometimes - no clue why and when:

----------------------- snip -----------------------
File "/home/bank/zbsp/buildout/src/bsp/bsp/torder.py", line 183, in
search_torder_tmpl
customer = get_customer(bspconf, session, customerid=customerid)
File "/home/bank/zbsp/buildout/src/bsp/bsp/customer.py", line 71, in
get_custo
mer
customer = session.query(Customer).filter_by(
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/query.py",
line 1226, in first
ret = list(self[0:1])
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/query.py",
line 1147, in __getitem__
return list(res)
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/query.py",
line 1286, in __iter__
self.session._autoflush()
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/session.py",
line 899, in _autoflush
self.flush()
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/session.py",
line 1354, in flush
self._flush(objects)
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/session.py",
line 1359, in _flush
if (not self.identity_map.check_modified() and
File "/home/bank/zbsp/buildout/eggs/SQLAlchemy-0.5.4p1-py2.4.egg/sqlalchemy/orm/identity.py",
line 56, in check_modified
for state in self._mutable_attrs:
RuntimeError: dictionary changed size during iteration
----------------- snip ------------------

Any hints about what to do?

Best Regards,
Hermann


--
her...@qwer.tk
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7

Conor

unread,
Nov 24, 2009, 4:21:31 PM11/24/09
to sqlal...@googlegroups.com
Looks like this was a bug and was fixed in 0.5.6. Time to upgrade?

You may be able to work around this issue somewhat by forcing a garbage
collection just before your query:
import gc
...
gc.collect()
customer = session.query(Customer).filter_by(
...

-Conor

Michael Bayer

unread,
Nov 24, 2009, 4:23:49 PM11/24/09
to sqlal...@googlegroups.com
I see "0.5.4p1" ! upgrading is always the first response. this was a
bug that was fixed.
> --
>
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
>

Hermann Himmelbauer

unread,
Nov 26, 2009, 6:53:50 AM11/26/09
to sqlal...@googlegroups.com, Michael Bayer
Am Dienstag 24 November 2009 22:23:49 schrieb Michael Bayer:
> I see "0.5.4p1" ! upgrading is always the first response. this was a
> bug that was fixed.

Thanks a lot, this seems to have solved it!
Reply all
Reply to author
Forward
0 new messages