-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutations support #47
Comments
It would be good to be able to detect if a table has an auto-incrementing primary key - if it does, an insert can be supported by providing the non-primary-key columns. If not, then inserts will also need to include the desired primary key. |
Graphene docs: https://docs.graphene-python.org/en/latest/types/mutations/ import graphene
class CreatePerson(graphene.Mutation):
class Arguments:
name = graphene.String()
ok = graphene.Boolean()
person = graphene.Field(lambda: Person)
def mutate(root, info, name):
person = Person(name=name)
ok = True
return CreatePerson(person=person, ok=ok)
class Person(graphene.ObjectType):
name = graphene.String()
age = graphene.Int()
class MyMutations(graphene.ObjectType):
create_person = CreatePerson.Field()
# We must define a query for our schema
class Query(graphene.ObjectType):
person = graphene.Field(Person)
schema = graphene.Schema(query=Query, mutation=MyMutations) Then: mutation m {
createPerson(name:"Peter") {
person {
name
}
ok
}
} |
Maybe the configuration that defines these should use YAML (or JSON) strings containing the GraphQL type language. https://graphql.org/learn/schema/ input ReviewInput {
stars: Int!
commentary: String
} |
The |
Datasette 1.0 alpha has JSON write APIs now, which could help inform the design and implementation of this: https://docs.datasette.io/en/1.0a2/json_api.html#the-json-write-api |
Supporting mutations for inserting / updating data is a very useful next step.
The text was updated successfully, but these errors were encountered: