graphql-python / graphql-python/graphene-sqlalchemy
Refactor SQLAlchemyConnectionField to use SQLAlchemyObjectType.get_query()
- Dominant language
- Python
- Stars
- 985
- Forks
- 223
- PR merge metrics
- No merged PRs in 30d
Description
Right now, `SQLAlchemyConnectionField` uses the `get_query()` implementation in `graphene_sqlalchemy.utils`. The same code is in `SQLAlchemyObjectType`.
https://github.com/graphql-python/graphene-sqlalchemy/blob/1d353f71f4ff256dcf69a7a13a27e4865282b044/graphene_sqlalchemy/fields.py#L18-L20
https://github.com/graphql-python/graphene-sqlalchemy/blob/1d353f71f4ff256dcf69a7a13a27e4865282b044/graphene_sqlalchemy/types.py#L146-L149
This means that if someone wants to update the query for an `SQLAlchemyObjectType`, e.g. to implement permissions restrictions, they have to subclass not only `SQLAlchemyObjectType` but also `SQLAlchemyConnectionField`.
I suggest refactoring `SQLAlchemyConnectionField` to re-use the `get_query()` implementation of the `SQLAlchemyObjectType` it wraps. I'm willing to look into creating a PR if there is interest.
Contributor guide
Assessment
This issue has not been assessed yet.