graphql-python / graphql-python/graphene-sqlalchemy

SQLAlchemyConnectionField sort works only for top-level query.

未关闭
#163 3 条评论 15 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
985
派生
223
PR 合并指标
30 天内没有已合并 PR

描述

When I have SQLAlchemyConnectionField in top-level query, like in the [example](http://docs.graphene-python.org/projects/sqlalchemy/en/latest/tips/#sorting) it works perfectly.

But if I have `Query -> Viewer -> SomeObject -> PetConnection -> Pet`
sort won't work.
In case of top level query `UnsortedSQLAlchemyConnectionField.get_query` is called, which injects sorting.
In case of nested object connection resolve - gettattr already takes model object (SomeObject) with
Pets array populated from the db. So getattr just takes these pet without any ordering.

Workaround here is to have custom resolver, but it would be much better to fix it on library level.
Thanks!

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。