TupleLoader distinct on all included loaders#324
TupleLoader distinct on all included loaders#324jekel wants to merge 1 commit intopython-gino:masterfrom
Conversation
Pull Request Test Coverage Report for Build 1148
💛 - Coveralls |
|
Thanks for the PR! As you said, it's not always true that all results in sub-loaders are distinct. I also understand from the added test case. But it's also not always true that all results have to be distinct to make this tuple distinct, depending on use cases. For example, I want to iterate through (company, team) pairs instead of company.teams which needs two levels of for-loops. |
|
Hm... i have an idea, TupleLoader must also relay on |
|
By One way to get what you want may be to check each returned tuple, and save it to context, like |
|
I mean, when you have query result like that, with
we can automaticaly find it in |
|
I'm not sure I get what you mean. Like this? TupleLoader(
(
User.load(add_company=Company),
ColumnLoader(query.c.test_column),
),
group_by=User,
) |
684f7b1 to
3969c27
Compare
d3bba04 to
79e7d4c
Compare
When using TupleLoader with complex query like: (ModelOne.distinct(ModelOne.id).load(...=ModelTwo.distinct...), CustomLoader(query.column_name))
result is incorrect, becase, it assumes that all rows results from each loader are distinct which is not always true