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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | affdceef979a3d8e1f4e7e1e2a64380c60136e99695702c7c72e6f4d15ec1050 |
|
MD5 | f7fff65c158466dd255dd4ac82265e99 |
|
BLAKE2b-256 | 1acc411ea22a814e3a1a0ac25591fafded1cf68243dbf936231d16bf10579c39 |
Close
Hashes for graphene_django_query_optimizer-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10c2c064ace039abb242fbc703423f1b2d7707d5efa31456ca4c2d26ffc0e15d |
|
MD5 | 64ea37576ccfc583bfd5db700a47a60e |
|
BLAKE2b-256 | 96f717313d18ed42802be108a8205961efb55402d790979cfa61add4d9ce3ab5 |