Description
This is going to be a discussion thread to debate whether it is good to implement mutations in graphene-sqlalchemy. There is definitely a scope for this feature and I think it's useful, so the real question is more towards how to implement it.
We can probably start with creating objects and then later expand to updating the various attributes.
There are discussions around this topic in #213 as well as #29. I'll copy the relevant items here so that we won't have to repeat them again.
Points to note:
- Have a class named
SQLAlchemyInputObjectType
and have model and exclude_fields as meta properties.
class CreateUser(SQLAlchemyInputObjectType):
class Meta:
exclude_fields = ('id', )
model = UserModel
-
No need to worry about hybrid or composite columns as they are basically created from other columns. So, we just need a mechanism to just accept the fields. So, a function named
construct_fields_for_input
. -
How to handle relationships ?
Since we are creating row entries for the table, we can probably acceptid
of the related table entry and convert it to the database id.
@jnak thoughts ?