Search code examples
djangographqldjango-filtergraphene-pythongraphene-django

DjangoFilterConnectionField query for all records


I'm using DjangoFilterConnectionField with a django-graphene and django-filter. and I'd like to know if it's possible to get all the records via a query?

Consider the following code:

class Query(graphene.AbstractType):
    txt = graphene.Field(LocalizedTxtType)
    all_txts = DjangoFilterConnectionField(LocalizedLocalizedTxtType)

How can I get all records with no filter (i.e. allTxts) ? Do I need to add a resolve_all myself , or does DjangoFilterConnectionField provide a way to query for all records?


Solution

  • Duplicate of How do I change relay connection limit in graphene django

    By default the DjangoFilterConnectionField "max_limit" is set to 100. If set to None, it will fetch all records:

    all_txts = DjangoFilterConnectionField(LocalizedLocalizedTxtType, max_limit=None)