Receiving the above error randomly (so far once a month on average) in a live system I have set up. The problem is the error doesn't persist (i.e. goes away when I touch the app.wsgi file) so it's difficult to determine what's causing the problem. The query it seems to be failing on is the first one used on login. i.e.
user = db_session.query(Users).filter(Users.username == username, Users.password == password).first()
This works fine the majority of the time, and has been covered in unittests.
The full traceback error is as follows:
[:error] File "/path/to/my/python/file.py", line 23, in get_user_object
[:error] user = db_session.query(Users).filter(Users.username == username, Users.password == password).first()
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2445, in first
[:error] ret = list(self[0:1])
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2281, in __getitem__
[:error] return list(res)
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 84, in instances
[:error] util.raise_from_cause(err)
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
[:error] reraise(type(exception), exception, tb=exc_tb)
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 51, in instances
[:error] for query_entity in query._entities
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 3312, in row_processor
[:error] polymorphic_discriminator=self._polymorphic_discriminator
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 313, in _instance_processor
[:error] getter = result._getter(col)
[:error] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/result.py", line 495, in _getter
[:error] return self._metadata._getter(key)
[:error] AttributeError: 'NoneType' object has no attribute '_getter'
The problem was resolved by doing a
pip install sqlalchemy --upgrade
on the given live system as suggested by rmn in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With