RuntimeError: maximum recursion depth exceeded -- When a column is named 'state'.

Issue #1009 resolved
Former user created an issue

I think I've found a bug when a column is named 'state'. I'm getting 'RuntimeError: maximum recursion depth exceeded' exception. At first I thought it had something to do with the underscores I am using as the first character of all my column names, but it just seems to be the word 'state' itself. I've attached a file that demonstrates this unusual situation. This was found in version 0.4.5.

This is the actual exception traceback:

File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.5-py2.5.egg/sqlalchemy/orm/attributes.py", line 44, in __get__
  return self.impl.get(instance._state)

Comments (4)

  1. Former user Account Deleted

    My email is: carl.nobile@gmail.com I'd be more that happy to correspond about the bug I posted. -Carl

  2. Mike Bayer repo owner

    this bug is not surprising. assuming we are merging the user_defined_state branch soon, I'd recommend we have the fix over there since the methodology for getting at "_state" is changing. ultimately though the fix will probably have to be of the "name change" variety, meaning you still could get in trouble if you named a column "_sa_state", which is what we'd probably call it.

    as a workaround for now you should redefine the name at the ORM level using the properties dictionary, or set a "key" attribute on the actual Column which changes the name to something non-conflicting.

  3. Log in to comment