Automatically optimize SQL queries in Graphene-Django schemas.
Project description
Graphene Django Query Optimizer
pip install graphene-django-query-optimizer
Documentation: https://mrthearman.github.io/graphene-django-query-optimizer/
Source Code: https://github.com/MrThearMan/graphene-django-query-optimizer/
Contributing: https://github.com/MrThearMan/graphene-django-query-optimizer/blob/main/CONTRIBUTING.md
Solve the GraphQL N+1 problem in graphene-django applications
just by changing a few imports, automatically adding the appropriate
only
,
select_related
,
and prefetch_related
method calls to your QuerySets to fetch only what you need.
import graphene
from graphene_django import DjangoListField
from example import ExampleModel
# from graphene_django import DjangoObjectType # old import
from query_optimizer import DjangoObjectType # new import
class ExampleType(DjangoObjectType):
class Meta:
model = ExampleModel
class Query(graphene.ObjectType):
all_examples = DjangoListField(ExampleType)
schema = graphene.Schema(query=Query)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for graphene_django_query_optimizer-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab73955469d774aa66315a30ea18511e04f1099f0bb379daa5b64db02b11974d |
|
MD5 | 41ecb73c1de42052a9dca45743620939 |
|
BLAKE2b-256 | 372dbf94cf1ecbcbc14bfdf4793662a011122e567fceb3f4047d9eaa5f7f5e09 |
Close
Hashes for graphene_django_query_optimizer-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cfe320d98bd535d11ae3885a162c0ab3cbb80ff311653567e453985607a19d1 |
|
MD5 | 7faf8bfc0d79b1270b0bedda31f7c7cc |
|
BLAKE2b-256 | 2afb184cc7dd738bf0f3a858cd036e8480998722d665a21df2ad0c5df33ecdc0 |