After querying comes mutation, which is an operation which writes or otherwise transforms data. In our API, we'll be implementing a single mutation that will create new Session records, which themselves have accompanying cupping records. Again, we're able to reuse helper functions and code to perform some of this work and can focus on the GraphQL code. The following additions to the handlers/graphql.py code implements creating new Session records. There is a slight change to the creation of the schema object, where we pass in a reference to our Mutation class:
class CuppingInput(graphene.InputObjectType): name = graphene.String(required=True) scores = graphene.types.json.JSONString() overall_score = graphene.Float(required=True) ...