-
Notifications
You must be signed in to change notification settings - Fork 227
Global ids from objects with composite primary keys are not correctly extracted #43
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
A serialization format of complex ids should probably be decided upon too, due to the way sqlalchemy's Query.get() expects ids to be entered. |
A somewhat simple oneway solution is to make SQLAlchemyObjectType.resolve_id return a tuple of the primary keys if it is a list with more than one entry: def resolve_id(self, args, context, info):
graphene_type = info.parent_type.graphene_type
if is_node(graphene_type):
keys = self.__mapper__.primary_key_from_instance(self)
return tuple(keys) if len(keys) > 1 else keys[0]
return getattr(self, graphene_type._meta.id, None) |
This is now merged, and also fixed in upcoming Graphene version |
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. |
Due to the way graphene-sqlalchemy constructs global ids, it is not possible to get unique global ids from objects with composite primary keys, typically association objects.
The text was updated successfully, but these errors were encountered: