You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use graphene-sqlalchemy in a project where classical mapping is used (https://docs.sqlalchemy.org/en/13/orm/mapping_styles.html#classical-mappings). I can see in some reports here (#130 (comment)) that setting Base.query is a needed step to get things working, and there is no declararive base in classical mapping. Is there a way to make this work without having to change the entire code to use declarative mapping?
When I try to make a query I get An error occurred while resolving field Equipment.idgraphql.error.located_error.GraphQLLocatedError: 'Equipment' object has no attribute '__mapper__'
The text was updated successfully, but these errors were encountered:
Well, after some trial and error (and some basic reading of exception messages, I must admit) I was able to get it working as follows:
When mapping your tables, with the usual method described in sqlalchemy manual:
from sqlalchemy.orm import mapper
mapper(YourClass, your_table_metadata)
you can keep the returned Mapper object in the __mapper__ field of your class
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.
I'm trying to use graphene-sqlalchemy in a project where classical mapping is used (https://docs.sqlalchemy.org/en/13/orm/mapping_styles.html#classical-mappings). I can see in some reports here (#130 (comment)) that setting Base.query is a needed step to get things working, and there is no declararive base in classical mapping. Is there a way to make this work without having to change the entire code to use declarative mapping?
When I try to make a query I get
An error occurred while resolving field Equipment.id
graphql.error.located_error.GraphQLLocatedError: 'Equipment' object has no attribute '__mapper__'
The text was updated successfully, but these errors were encountered: