auto-correlation has reverse defaults with Query vs. select()
call to correlate=False inside of _compile_context() takes effect for subquery(), statement, as_scalar(). This is inconsistent vs. that of select().
since we already pulled the trigger on 0.7 need to push this into 0.8.
Comments (7)
-
reporter -
Account Deleted - changed watchers to diana
(original author: diana)
-
Account Deleted (original author: diana) The above tests really only cover the second #correlate=False case in _compile_context().
I couldn't for the life of me come up with tests that failed (and then passed) by changing the first #correlate=False (if context.multi_row_eager_loaders and self._should_nest_selectable). I did come up with test cases that exercised that code path (by adding a joinedload and a limit by), but it didn't seem to matter if correlate was false or true.
The orig_query._clone().correlate(None) case is covered a bit by test.orm.test_subquery_relations.EagerTest.test_orderby_related.
I also had tests that tested .label('address_count') instead of as_scalar() wrt. auto-correlate, but I suspect they're really testing the same code path (though I didn't actually verify that), so I didn't include them in the patch.
I think this is as far as I can go with this one, without help -- I'm not sure how to exercise the other two cases. I did try! :)
Cheers.
-
Account Deleted (original author: diana) Toying with pull requests instead of patches.
https://bitbucket.org/sqlalchemy/sqlalchemy/pull-request/5/make-auto-correlation-the-same-for-query
-
reporter 8b16cd876cb157d6f06863f2e345ff3e1d56972f in the 0.8 branch
-
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.8.0b1 (automated comment)
- Log in to comment
patch: