-
Notifications
You must be signed in to change notification settings - Fork 227
AttributeError: entity #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As far as I can tell, I'm closing this issue because it does not seem to have anything to do with |
note that the model as given works fine in an isolated test case without all the flask/graphene-sqlalchemy imports added, so the model as given is fine, I ran it and it has no issues. someone needs to pdb into the exception to see what the ultimate AttributeError (I assume it's an AttributeError) is being raised. |
Ran into exactly the same error multiple times and it is driving me crazy! SQLAlchemy itself passed all tests. It only shows this error when combined with graphene. For one time, removing |
did anyone try calling configure_mappers() at the right time so that backrefs are all set up? |
I eventually found the answer. The reason for the error is that the model resolution needs the model to be imported somewhere before. So try to import the model in the beginning of the app fixed my issue. The accepted answer in this stack overflow hit the nail on the head: https://stackoverflow.com/questions/45534903/python-sqlalchemy-attributeerror-mapper/45540141#45540141 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue. |
Python 3.7.4
SQLAlchemy 1.3.7
graphene-sqlalchemy 2.2.2
Flask 1.1.1
Flask-SQLAlchemy 2.4.0
psycopg2 2.8.3
Linux xxx 5.1.21-200.fc29.x86_64 #1 SMP Mon Jul 29 15:30:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
The following code snippets show just a simple One-to-Many Relationship. I tried it with and back_populates and with backref, Uni- and Bidirectional. I also tried Many-to-Many relationships with a association Table. But nothing helped.
I always get the error shown in the last Bash-snippet.
Whats wrong here?
I found out, that sqlalchemy.orm.relationships.RelationshipProperty give that exception when I try to call .entity on it.
I already opened an issue on the sqlalchemy github https://github.com/sqlalchemy/sqlalchemy/issues/4819 and got the answer above. Hopefully it helps you to help me to fix this issue ;)
It is happen in sqlalchemy/orm/mapper.py(1947)_post_configure_properties() on line 1947
The text was updated successfully, but these errors were encountered: