Opened 12 years ago
Last modified 9 years ago
#20127 new Cleanup/optimization
Unify subquery generation in the ORM — at Version 2
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
There are some different ways for doing subqueries in the ORM currently. Query.split_exclude()
, subqueries in deletion, as_nested_sql()
and SubqueryConstraint
seem to do something similar. Sometimes there are duplicated code paths, sometimes upper layers do something the lower layers will repeat later on.
I think every instance where a subquery constraint is needed should use the SubqueryConstraint
class either directly, or through QuerySet.filter()
or sql.Query.build_filter()
. This will allow doing all the somewhat complicated setup in one place.
Change History (2)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|