#17339 closed New feature (fixed)
[nonrel] Factor out has_result into database backend
Reported by: | Jonas H. | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | nonrel |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
(This patch is part of the changes made to the inofficial fork "Django-nonrel" which adds basic support for non-relational databases.)
Refactors some code of sql.query.Query.has_result
into the database backend. This is required so that database backends can use specialized more performant "query has any results" checks.
Attachments (1)
Change History (10)
by , 13 years ago
Attachment: | factor-out-has_results.patch added |
---|
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → New feature |
comment:3 by , 13 years ago
Pretty sure the test suite already exercises this code quite heavily, so I think in this case of a pure refactoring there aren't more tests needed, as long as the existing ones pass. And obviously docs aren't relevant at this level either.
In terms of the patch specifics, what's the justification for why some query modification bits are moved into the compiler's has_results and not others?
comment:4 by , 13 years ago
I have no idea. Maybe I can get the original author, Waldemar Kornewald, to join these threads...
comment:5 by , 13 years ago
The reason why I only moved two lines to the compiler is that all the other operations are DB independent optimizations. The selected fields and query ordering etc need to be cleared on NoSQL, too. Only the extra mask is a SQL specific optimization and other DBs might use some other trick. Anyway,it would be easy to change the patch to also allow for overriding the other operations, but we should keep the current separation between extra mask and general optimizations because all nonrel backends only override the extra mask code and they shouldn't have to reimplement the general optimizations unnecessarily.
comment:6 by , 11 years ago
Duplicate of #14857 which was closed as "won't fix" by Russ, but I'm not sure if his reasoning still holds since query-refactor was never merged and NoSQL support seems to have dropped off the radar as far as I know:
"NoSQL support isn't something that needs to be addressed piecemeal. This isn't the only place that raw SQL leaks out of the compiler; these leaks need to be addressed as a whole, not piecemeal. As I've told you *many* times Waldemar, NoSQL support is on my radar for 1.4, when we address merging Alex's query-refactor SoC branch."
I've updated the patch to apply cleanly and ensure that all tests pass. Any objections to merging this?
comment:7 by , 11 years ago
The NoSQL branch efforts are obviously dead, but the pull request here makes perfect sense to me. It's a small piece of the puzzle, but it doesn't hurt, so no objections on my part to merging.
comment:8 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:9 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Giving backends more control here makes sense to me.