Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLAlchemyConnectionField sort works only for top-level query. #163

Open
comtihon opened this issue Sep 5, 2018 · 3 comments
Open

SQLAlchemyConnectionField sort works only for top-level query. #163

comtihon opened this issue Sep 5, 2018 · 3 comments

Comments

@comtihon
Copy link

comtihon commented Sep 5, 2018

When I have SQLAlchemyConnectionField in top-level query, like in the example 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!

@igr-santos
Copy link

Hello @comtihon, have you been able to work out a custom solution? I'm having this same problem and I still can not think of something generic for the models.

@kkinder
Copy link

kkinder commented Feb 8, 2020

Possibly helpful for others: #164

@sabard
Copy link
Collaborator

sabard commented Sep 30, 2020

Would love to see an update to this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants