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
Hi! First off thanks for this module, it's really great, and for the release yesterday, I'd just come across the prefetch/select related bug and it was fixed before I could report it!
So I have been playing extensively and want to use this alongside some sort of pagination. Currently I have a query that looks like:
class PaginatedInterface(graphene.Interface):
page = graphene.Int()
pages = graphene.Int()
has_next = graphene.Boolean()
has_prev = graphene.Boolean()
total_count = graphene.Int()
results = None
class PaginatedInstanceType(graphene.ObjectType):
results = graphene.List(InstanceType)
class Meta:
interfaces = (PaginatedInterface,)
Where InstanceType is a standard django-graphene DjangoObjectType.
Unfortunately this seems to result in the optimizer being disregarded and it runs n+1 queries. I've tried the recommended advanced usages but they all seem to rely on the ObjectType being an actual DjangoObjectType, which doesn't work here as I don't have a model at the top level.
I have found that if I 'trick' it by settings the results selection as the main selection, the field_name to results and the parent type to the GraphQLObject of the PaginatedInstanceType (passed in here as object_type) then it all works beautifully.
Hi! First off thanks for this module, it's really great, and for the release yesterday, I'd just come across the prefetch/select related bug and it was fixed before I could report it!
So I have been playing extensively and want to use this alongside some sort of pagination. Currently I have a query that looks like:
Where results is a Django queryset.
To make this work I have a resolver which does:
and the type:
Where InstanceType is a standard django-graphene DjangoObjectType.
Unfortunately this seems to result in the optimizer being disregarded and it runs n+1 queries. I've tried the recommended advanced usages but they all seem to rely on the ObjectType being an actual DjangoObjectType, which doesn't work here as I don't have a model at the top level.
I have found that if I 'trick' it by settings the results selection as the main selection, the field_name to results and the parent type to the GraphQLObject of the PaginatedInstanceType (passed in here as object_type) then it all works beautifully.
Before I start trying to make any changes, I wanted to check that this isn't currently supported and I haven't just missed how to go about it?
Thanks!
The text was updated successfully, but these errors were encountered: