Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

graphql-python/graphene-gae

Repository files navigation

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`:

importsysforpathin ['libs']: ifpathnotinsys.path: sys.path[0:0] = [path]

Examples

Here's a simple GAE model:

classArticle(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:

importgraphenefromgraphene_gaeimportNdbObjectTypeclassArticleType(NdbObjectType): classMeta: model=ArticleclassQueryRoot(graphene.ObjectType): articles=graphene.List(ArticleType) @graphene.resolve_only_argsdefresolve_articles(self): returnArticle.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

About

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

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 10