graphql-python / graphql-python/graphene-sqlalchemy

SQLAlchemyConnectionField sort works only for top-level query.

Aberta
#163 3 comentários 15 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Python
Estrelas
985
Forks
224
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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!

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start with UnsortedSQLAlchemyConnectionField.get_query and the nested connection resolution path described in the issue, including getattr on the parent model. Reproduce sorting through a Viewer-to-SomeObject-to-PetConnection relationship, then ensure nested connections apply the requested ordering rather than using the already-populated array.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
graphql, python, sqlalchemy
Domínio
api, databases
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.