Uh oh!
There was an error while loading. Please reload this page.
Subqueryloader - #330
Conversation
Pull Request Test Coverage Report for Build 1214
💛 - Coveralls |
wwwjfy
commented
Sep 9, 2018
As discussed in #323, I'm not convinced that this is the complete solution. The use case in the unit test can be achieved in the latest version of Gino already. We do not need |
jekel
commented
Sep 9, 2018
Why not?
Can you show me please also how can i achive the same without using |
wwwjfy
commented
Sep 9, 2018
We "do" need, not we "don't" need. 😂
|
@wwwjfy Sorry, i have read it wrong :)
what happens when there will be several models inside subquery? please take it mind when creating new use case |
wwwjfy
commented
Sep 9, 2018
Exactly. That's the cases I'd like to explore, so as to give users straightforward loader and least surprise. Thanks 😊 |
a8cfb1d to
3f2356bComparejekel
commented
Oct 17, 2018
Hi @wwwjfy , how is going your research? |
wwwjfy
commented
Oct 17, 2018
Sorry for the silence! I just picked up a few issues again and will work out something this weekend. |
wwwjfy
commented
Oct 21, 2018
I created #365, trying to show what can be done in the description of this issue, for subqueries and aggregate functions. Basically, it won't be hard as long as we keep the reference of columns and/or models in a subquery and pass them to loaders. |
wwwjfy
commented
Oct 21, 2018
I don't know if this can meet your needs. If not, an example will be very helpful. |
jekel
commented
Oct 23, 2018
@wwwjfy i have found the case your code does not cover - complete model loading from subquery without specifying all columns explicitly |
wwwjfy
commented
Oct 24, 2018
@jekel I could achieve this: asyncdeftest(user):
ua=User.alias()
query=select([ua]).alias()
outer_query=select([text('1'), query])
result=awaitouter_query.gino.load(ua).all()
assertlen(result) ==1assertresult[0].id==user.idIs it what you said? |
684f7b1 to
3969c27Compared3bba04 to
79e7d4cCompare
SubqueryLoader is used to load Models from sqlalchemy aliased queries, opposite of #326 which works only on aliased gino Models
Common usecase for this loader will be - when you will have complex query with subquery, aggregated columns, etc... and you need to get result as Model object defined inside subquery
Previus discussion can be found here #323