graphql-python / graphql-python/graphene-sqlalchemy

SQLAlchemyConnectionField sort works only for top-level query.

オープン
#163 コメント 3 件 リアクション 15 件 担当者 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 を短くまとめたダイジェスト。