7

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'
5
  • Do you have the full traceback of the exception? Commented Feb 13, 2016 at 10:57
  • Have included now, see above. Commented Feb 13, 2016 at 11:08
  • What version of SQLAlchemy are you using? Commented Feb 13, 2016 at 12:03
  • 3
    looks like this bug: bitbucket.org/zzzeek/sqlalchemy/issues/3481. It was fixed in 1.0.7. Commented Feb 13, 2016 at 13:47
  • Perfecto, I'll give it a whizz. Cheers Commented Feb 13, 2016 at 13:50

2 Answers 2

4

The problem was resolved by doing a

pip install sqlalchemy --upgrade

on the given live system as suggested by rmn in the comments.

Sign up to request clarification or add additional context in comments.

Comments

-1

Upgrading from 1.3.13 to 1.4.36 solved the issue for me.

2 Comments

This solution is already proposed in the existing answer.
My intention was to add a range on versioning to help easily identify which one is causing the issue, my apologies if this was not the correct way to improve the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.