Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrthearman/graphene-django-query-optimizer
Automatically optimize SQL queries in Graphene-Django schemas.
https://github.com/mrthearman/graphene-django-query-optimizer
django graphene graphene-django optimization orm python sql
Last synced: 2 months ago
JSON representation
Automatically optimize SQL queries in Graphene-Django schemas.
- Host: GitHub
- URL: https://github.com/mrthearman/graphene-django-query-optimizer
- Owner: MrThearMan
- License: mit
- Created: 2023-08-13T20:18:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-22T05:21:50.000Z (6 months ago)
- Last Synced: 2024-07-26T13:32:45.359Z (6 months ago)
- Topics: django, graphene, graphene-django, optimization, orm, python, sql
- Language: Python
- Homepage: https://pypi.org/project/graphene-django-query-optimizer/
- Size: 3.25 MB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Graphene Django Query Optimizer
[![Coverage Status][coverage-badge]][coverage]
[![GitHub Workflow Status][status-badge]][status]
[![PyPI][pypi-badge]][pypi]
[![GitHub][licence-badge]][licence]
[![GitHub Last Commit][repo-badge]][repo]
[![GitHub Issues][issues-badge]][issues]
[![Downloads][downloads-badge]][pypi]
[![Python Version][version-badge]][pypi]```shell
pip install graphene-django-query-optimizer
```---
**Documentation**: [https://mrthearman.github.io/graphene-django-query-optimizer/](https://mrthearman.github.io/graphene-django-query-optimizer/)
**Source Code**: [https://github.com/MrThearMan/graphene-django-query-optimizer/](https://github.com/MrThearMan/graphene-django-query-optimizer/)
**Contributing**: [https://github.com/MrThearMan/graphene-django-query-optimizer/blob/main/CONTRIBUTING.md](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`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#only),
[`select_related`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related),
and [`prefetch_related`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related)
method calls to your QuerySets to fetch _only_ what you need.```python
import graphene
from example_project.app.models import Examplefrom query_optimizer import DjangoObjectType, DjangoListField
class ExampleType(DjangoObjectType):
class Meta:
model = Exampleclass Query(graphene.ObjectType):
all_examples = DjangoListField(ExampleType)schema = graphene.Schema(query=Query)
```[coverage-badge]: https://coveralls.io/repos/github/MrThearMan/graphene-django-query-optimizer/badge.svg?branch=main
[coverage]: https://coveralls.io/github/MrThearMan/graphene-django-query-optimizer?branch=main
[downloads-badge]: https://img.shields.io/pypi/dm/graphene-django-query-optimizer
[graphene-django]: https://github.com/graphql-python/graphene-django
[issues-badge]: https://img.shields.io/github/issues-raw/MrThearMan/graphene-django-query-optimizer
[issues]: https://github.com/MrThearMan/graphene-django-query-optimizer/issues
[licence-badge]: https://img.shields.io/github/license/MrThearMan/graphene-django-query-optimizer
[licence]: https://github.com/MrThearMan/graphene-django-query-optimizer/blob/main/LICENSE
[N+1 problem]: https://stackoverflow.com/a/97253
[pypi-badge]: https://img.shields.io/pypi/v/graphene-django-query-optimizer
[pypi]: https://pypi.org/project/graphene-django-query-optimizer
[repo-badge]: https://img.shields.io/github/last-commit/MrThearMan/graphene-django-query-optimizer
[repo]: https://github.com/MrThearMan/graphene-django-query-optimizer/commits/main
[status-badge]: https://img.shields.io/github/actions/workflow/status/MrThearMan/graphene-django-query-optimizer/test.yml?branch=main
[status]: https://github.com/MrThearMan/graphene-django-query-optimizer/actions/workflows/test.yml
[version-badge]: https://img.shields.io/pypi/pyversions/graphene-django-query-optimizer