Skip to content
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

Global ids from objects with composite primary keys are not correctly extracted (again) #388

Closed
genericmoniker opened this issue Apr 3, 2023 · 3 comments
Labels

Comments

@genericmoniker
Copy link

In #43 a change was made to convert composite keys to a tuple.

graphql-core made a change such that a tuple is no longer accepted as a valid ID (whereas it would previously just call str on the tuple).

The result is an error such as the following when an object of the type is requested with its id field:

ID cannot represent value: (<UUID instance>, <UUID instance>)
@erikwrede
Copy link
Member

Thanks for bringing this up! The easiest fix would most likely be to convert tuples to strings manually here:

def resolve_id(self, info):
# graphene_type = info.parent_type.graphene_type
keys = self.__mapper__.primary_key_from_instance(self)
return tuple(keys) if len(keys) > 1 else keys[0]

I'll check with the team to make sure this has no other implications and get back to you!

@erikwrede erikwrede added the bug label Apr 9, 2023
@erikwrede
Copy link
Member

sorry for the long wait, this was fixed in #399

Copy link

github-actions bot commented Jun 2, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants