Brings prisma playground to Graphene and more
Project description
Graphene prisma
Brings prisma playground to graphene and more
Install
To install graphene_prisma
, you need to specify one of the supported frameworks
pip install graphene_prisma[framework]
or
pip install graphene_prisma
pip install framework
Supported frameworks :
e.g. starlette
pip install graphene_prisma[starlette]
Usage
To use graphene_prisma
from graphene_prisma.[framework] import [GraphQLHandler]
- [framework] : name of the framework (responder, starlette,...)
- [GraphQLHandler]: name of the graphql view in your framework (
GraphQLView
forresponder
andGraphQLApp
forstarlette
)
Here is a list of the graphql classes for each framework
framework | GraphQL view |
---|---|
responder | GraphQLView |
starlette | GraphQLApp |
Starlette
from starlette.applications import Starlette
from graphene_prisma.starlette import GraphQLApp
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return f"Hello {name}"
app = Starlette()
app.add_route('/', GraphQLApp(schema=graphene.Schema(query=Query)))
Responder
import responder
from graphene_prisma.responder import GraphQLView
api = responder.API()
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return f"Hello {name}"
schema = graphene.Schema(query=Query)
view = GraphQLView(api=api, schema=schema)
api.add_route("/graph", view)
api.run()
TODO
- Support other frameworks (django, flask,...)
- Tests
- Upload
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
graphene-prisma-0.1.0.tar.gz
(3.5 kB
view details)
File details
Details for the file graphene-prisma-0.1.0.tar.gz
.
File metadata
- Download URL: graphene-prisma-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a2227a6c7a16b68318439f03596c0f0f3b4b28ddee597d645e79b69971f2b46 |
|
MD5 | ce750e1fcd563a75806ab1408715a125 |
|
BLAKE2b-256 | d6cbd1fbc2ff789aa66e2afa1059d59b53921bb6b5fda488931e6f21e4e99164 |