All Projects → insolite → Graphene Peewee Async

insolite / Graphene Peewee Async

Graphene peewee-async integration

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Graphene Peewee Async

Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-9.37%)
Mutual labels:  graphql
Nextjs Graphql Sample
A simple app to demonstrate basic API functions built with REST and GraphQL
Stars: ✭ 29 (-9.37%)
Mutual labels:  graphql
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+2906.25%)
Mutual labels:  graphql
Example Kotlin Springboot Graphql
Projeto de exemplo com API GraphQL com dois crud’s simples, utilizando Kotlin, Spring Boot, Gradle etc.
Stars: ✭ 28 (-12.5%)
Mutual labels:  graphql
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+2868.75%)
Mutual labels:  graphql
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+2884.38%)
Mutual labels:  graphql
Redux Offline Examples
Examples for Redux-Offline
Stars: ✭ 28 (-12.5%)
Mutual labels:  graphql
Graphql Client
A Ruby library for declaring, composing and executing GraphQL queries
Stars: ✭ 961 (+2903.13%)
Mutual labels:  graphql
Catalyst
Typescript NodeJS Microservices Boilerplate with Generator CLI - Moleculer, GraphQL, REST, OAuth2, Jaeger, Grafana, Prometheus, Ory Hydra, Ory Keto w/ Access Control middleware, Moleculer-DB GraphQL mixin, Pug, Redis, sibling client repo (login, persistance layer, react-native-web, ios, android)
Stars: ✭ 30 (-6.25%)
Mutual labels:  graphql
Graphql
Bindings to libgraphqlparser for R
Stars: ✭ 31 (-3.12%)
Mutual labels:  graphql
Django Graph Api
Pythonic implementation of the GraphQL specification for the Django Web Framework.
Stars: ✭ 29 (-9.37%)
Mutual labels:  graphql
Graphql Parser Php
A PHP extension wrapping the libgraphqlparser library for parsing GraphQL.
Stars: ✭ 29 (-9.37%)
Mutual labels:  graphql
Graphql Auto Transformer
A custom transformer of the amplify-cli. It can control accessibility of auto generated fields.
Stars: ✭ 31 (-3.12%)
Mutual labels:  graphql
Eschool
eSchool Microservice based Solution
Stars: ✭ 29 (-9.37%)
Mutual labels:  graphql
Sql To Graphql Schema Generator
⚛️ Generate GraphQL Scheme Online From SQL Query - https://sql-to-graphql.now.sh/
Stars: ✭ 32 (+0%)
Mutual labels:  graphql
Graphql Compose
Toolkit for generating complex GraphQL Schemas on Node.js
Stars: ✭ 947 (+2859.38%)
Mutual labels:  graphql
Link state demo
🚀 Demonstrate how to support multiple stores in Apollo Link State
Stars: ✭ 30 (-6.25%)
Mutual labels:  graphql
Graphql Ide
⚡️ GraphQL IDE - An extensive IDE for exploring GraphQL API's
Stars: ✭ 965 (+2915.63%)
Mutual labels:  graphql
Graphql Upload
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various GoLang GraphQL servers
Stars: ✭ 32 (+0%)
Mutual labels:  graphql
Citation
Citation is a new generation CMS merging ideas of: Headless / GraphQL, static site generation and JavaScript component pre-rendering
Stars: ✭ 31 (-3.12%)
Mutual labels:  graphql

===================== graphene-peewee-async

graphene <https://github.com/graphql-python/graphene>_ + peewee-async <https://github.com/05bit/peewee-async>_ integration ❤️

Changelog <https://github.com/insolite/graphene-peewee-async/blob/master/CHANGELOG.md>_

Features

  • Querying
    • Fields selection (considered by SELECT statement)
    • Related entities subselection (using foreign key joins)
    • Filters (django-style lookups, like peewee.SelectQuery.filter args)
    • Order (multiple fields, asc/dsc support)
    • Pagination (page, paginate_by support plus unpaginated total count auto-fetching)
  • Mutations (both single object and bulk operating, filtering just like for querying)
    • Create
    • Update
    • Delete
    • Clone

Usage sample

.. code-block:: python

# Define models

class Author(Model):
    name = CharField()
    rating = IntegerField()

class Book(Model):
    name = CharField()
    year = IntegerField()
    author = ForeignKeyField(Author)

# Create nodes

class BookNode(PeeweeObjectType):
    class Meta:
        model = Book
        manager = db_manager

class AuthorNode(PeeweeObjectType):
    class Meta:
        model = Author
        manager = db_manager

# Create connections

class BookConnection(PeeweeConnection):
    class Meta:
        node = BookNode

# Aggregate queries

class Query(ObjectType):
    books = PeeweeConnectionField(BookConnection)

# Create schema

schema = Schema(query=Query, auto_camelcase=False)

# Execute graphql query

result = schema.execute('''
    query {
        books (filters: {author__name__ilike: "%Lovecraft%"}) {
            total
            edges {
                node {
                    id
                    name
                    author {
                        id
                        name
                    }
                }
            }
        }
    }''',
    return_promise=True,
    executor=AsyncioExecutor()
)

# Await result if required (failed queries are usually returning result
#                           synchronously with non-empty `result.errors`
#                           while successful ones requires awaiting
#                           of peewee/DB level queries of course)

if not isinstance(result, ExecutionResult):
    result = await result

# Enjoy the result :)

print(result.data)
#
# ===>
#
# {'books': {
#     'total': 2,
#     'edges': [
#         {'node': {
#             'id': 5,
#             'name': 'Dagon',
#             'author': {
#                 'id': 1,
#                 'name': 'Howard Lovecraft'
#             }
#         }},
#         {'node': {
#             'id': 6,
#             'name': 'At the Mountains of Madness',
#             'author': {
#                 'id': 1,
#                 'name': 'H.P. Lovecraft'
#             }
#         }}
#     ]
# }}

Advanced usage

Be sure to check API tests <https://github.com/insolite/graphene-peewee-async/tree/master/tests/test_api>_ for advanced query/mutation usages and auto-generating <https://github.com/insolite/graphene-peewee-async/blob/master/tests/common/schema.py>_ such schema for them.

Install

Install as package:

.. code-block:: bash

pip3 install graphene-peewee-async
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].