In graphene-django I have a pagination limit set in my settings.py
file like below.
GRAPHENE = {
'RELAY_CONNECTION_MAX_LIMIT': 150,
}
Let's say a particular query returns 200 items (I don't know beforehand) and I want to display all of this data on a graph. How do I stop graphene from paginating it when returning the results?
You can override the max_limit
argument for every DjangoFilterConnectionField
individually. Setting this to None
basically disables the limiting behaviour.
Suppose you have the following query for a UserNode
class:
class UserQuery(graphene.ObjectType):
all_users = DjangoFilterConnectionField(UserNode, max_limit=None)
The max_limit
parameter will internally be processed by the DjangoConnectionClass
which provides the limiting behaviour via the mentioned setting RELAY_CONNECTION_MAX_LIMIT
Beware though that this might lead to drastic performance issues in case of very large or expensive queries. Personally I would probably go for either a very high but still resonable limit depending on your data or preferrably look into implementing proper pagination behaviour on the client side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With