graphene.Schema object describes your data model and provides a GraphQL server with an associated set of resolve methods that know how to fetch data. The most basic schema you can create looks like this:
import graphene class Query(graphene.ObjectType): pass class Mutation(graphene.ObjectType): pass = graphene.Schema(query=Query, mutation=Mutation)schema
This schema doesn't do anything yet, but it is ready to accept new Query or Mutation fields.
Adding to the schema
If you have defined a
Mutation, you can register them with the schema:
import graphene import my_app.schema.Query import my_app.schema.Mutation class Query( # Add your Query objects here my_app.schema.Query, graphene.ObjectType ):pass class Mutation( # Add your Mutation objects here my_app.schema.Mutation, graphene.ObjectType ):pass = graphene.Schema(query=Query, mutation=Mutation)schema
You can add as many mixins to the base
Mutation objects as you like.
Read more about Schema on the core graphene docs