graphene-sqlalchemy
graphene-sqlalchemy copied to clipboard
Support for Soft Delete?
Is there any possibility we can add a feature that allows for soft deletes to be ignored?
https://github.com/graphql-python/graphene-sqlalchemy/blob/db3e9f4c3baad3e62c113d4a9ddd2e3983d324f2/graphene_sqlalchemy/utils.py#L22
I am about to fork this repo so I can add a filter to the query filter(delete_dt=None)
and that seems like overkill to just add that one line. Is there a simpler way to filter my joins, or potentially a patch we could introduce?
just noticed this example, will try it out and hopefully close
class ActiveSQLAlchemyObjectType(SQLAlchemyObjectType):
class Meta:
abstract = True
@classmethod
def get_node(cls, info, id):
return cls.get_query(info).filter(
and_(cls._meta.model.deleted_at==None,
cls._meta.model.id==id)
).first()```
I was looking for this as well, and I tried the above, but it never seems to even be called... Not sure if any has had success with this, I would really appreciate some guidance. Specifically I would love it if any objects with relationships would automatically add the filter method to the query when the node is being retrieved as a child of another query.