• This repository has been archived on 06/Sep/2022
  • Stars
    star
    117
  • Rank 292,021 (Top 6 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GraphQL Support for Google AppEngine [DEPRECATED - Looking for maintainers]

Graphene GAE (deprecated!)

⚠️ This repository is deprecated due to lack of maintainers. If you're interested in taking over let us know via the Graphene Slack

A Google AppEngine integration library for Graphene

Upgrade Notes

If you're upgrading from an older version (pre 2.0 version) please check out the Graphene Upgrade Guide.

Installation

To install Graphene-GAE on your AppEngine project, go to your project folder and runthis command in your shell:

pip install graphene-gae -t ./libs

This will install the library and its dependencies to the libs folder under your projects root - so the dependencies get uploaded withyour GAE project when you publish your app.

Make sure the libs folder is in your python path by adding the following to your `appengine_config.py`:

import sys

for path in ['libs']:
    if path not in sys.path:
        sys.path[0:0] = [path]

Examples

Here's a simple GAE model:

class Article(ndb.Model):
    headline = ndb.StringProperty()
    summary = ndb.TextProperty()
    text = ndb.TextProperty()

    author_key = ndb.KeyProperty(kind='Author')

    created_at = ndb.DateTimeProperty(auto_now_add=True)
    updated_at = ndb.DateTimeProperty(auto_now=True)

To create a GraphQL schema for it you simply have to write the following:

import graphene
from graphene_gae import NdbObjectType

class ArticleType(NdbObjectType):
    class Meta:
        model = Article

class QueryRoot(graphene.ObjectType):
    articles = graphene.List(ArticleType)

    @graphene.resolve_only_args
    def resolve_articles(self):
        return Article.query()

schema = graphene.Schema(query=QueryRoot)

Then you can simply query the schema:

query = '''
    query GetArticles {
      articles {
        headline,
        summary,
        created_at
      }
    }
'''
result = schema.execute(query)

To learn more check out the following examples:

Contributing

After cloning this repo, ensure dependencies are installed by running:

make deps
make install

Make sure tests and lint are running:

make test
make lint

More Repositories

1

graphene

GraphQL framework for Python
Python
7,978
star
2

graphene-django

Build powerful, efficient, and flexible GraphQL APIs with seamless Django integration.
Python
4,235
star
3

gql

A GraphQL client in Python
Python
1,474
star
4

flask-graphql

Adds GraphQL support to your Flask application.
Python
1,316
star
5

graphene-sqlalchemy

Graphene SQLAlchemy integration
Python
971
star
6

graphql-core

A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.
Python
498
star
7

graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)
Python
375
star
8

graphene-mongo

Graphene MongoEngine integration
Python
285
star
9

graphql-ws

GraphQL websockets
Python
271
star
10

graphene-pydantic

Integrate GraphQL with your Pydantic models
Python
220
star
11

swapi-graphene

GraphQL Starwars API using Graphene and Django
Python
172
star
12

sanic-graphql

Adds GraphQL support to your Sanic app.
Python
149
star
13

graphql-relay-py

A library to help construct a graphql-py server supporting react-relay
Python
145
star
14

aiohttp-graphql

Adds GraphQL support to your aiohttp app.
Python
118
star
15

graphql-server

This is the core package for using GraphQL in a custom server easily
Python
114
star
16

gql-next

A Python GraphQL Client library providing ability to validate and make type-safe GraphQL calls
Python
76
star
17

graphene-tornado

Python
52
star
18

graphene-federation

Federation implementation for Graphene.
Python
40
star
19

webob-graphql

GraphQL integration for WebOb based frameworks: Pyramid, Pylons...
Python
28
star
20

GraphQL-SublimeText

GraphQL language syntax for SublimeText
17
star
21

graphene-python.org

Graphene-Python.org official website
JavaScript
6
star