graphql-python / graphql-python/graphene-sqlalchemy

SQLAlchemyConnectionField sort works only for top-level query.

Abierto
#163 3 comentarios 15 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Python
Estrellas
985
Forks
223
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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!

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.