Optimize database access inside graphene queries.
Project description
graphene-django-optimizer
Install
pip install graphene-django-optimizer
Usage
# cookbook/ingredients/schema.py
import graphene
from graphene_django.types import DjangoObjectType
import graphene_django_optimizer as gql_optimizer
from cookbook.ingredients.models import Category, Ingredient
class CategoryType(DjangoObjectType):
class Meta:
model = Category
class IngredientType(DjangoObjectType):
class Meta:
model = Ingredient
class Query(object):
all_categories = graphene.List(CategoryType)
all_ingredients = graphene.List(IngredientType)
def resolve_all_categories(root, info):
return gql_optimizer.query(Category.objects.all(), info)
def resolve_all_ingredients(root, info):
return gql_optimizer.query(Ingredient.objects.all(), info)
Contribute
The system must have installed:
- python 3
- virtualenv
virtualenv -p python3 venv
. venv/bin/activate
pip install -r dev-requirements.txt
# run tests:
python setup.py test
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-optimizer-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41c497483110f6cb6b349c0b69f546a28716c6a195ea035da9c2123a8cddc4ab |
|
MD5 | 6d39288cae64a95144fe3a49d7326d4a |
|
BLAKE2b-256 | 5a3a81e695214499b7e74ff741b24ff686882daa0135790ceede38035753b5fb |
Close
Hashes for graphene_django_optimizer-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ffac1a2212cae96c28424d6b2cd9a4a35fcbcd3377ad5901ebdce0e74b24259 |
|
MD5 | fe5376398807f9cfee152a10e5b2463f |
|
BLAKE2b-256 | 7bfdf000ce14f9305d99373840e874ce2cb736374fe47fd5f321a0515ab779c2 |