#35836: ORM can produce invalid SQL when subclassing Query
-------------------------------------+-------------------------------------
Reporter: Ben Pearman | Owner: (none)
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* resolution: => invalid
* status: new => closed
Comment:
Django 3.2 has been EOL for 6 months now and while we accept patch to
allow extension of the ORM we don't offer any guarantees towards backward
compatibility around `sql.Query` API changes.
In other words, if you extend undocumented and unstable part of the
framework you must be prepared to adapt your code and provide a solution
that goes beyond bisecting the origin of your breakage.
In the case of 14c8504a37afad96ab93cf82f47b13bcc4d00621 I think it's a
sane change in towards extensibility and something we'd want to keep in
`main`. `SQLQuery.get_compiler` is by no means meant to be used as a hook
to augment the where clause of a `QuerySet`, this should be done at the
manager level.
At this point, even if we were to land a solution that you'd have to
provide and build a rationale for it wouldn't make it to a public release
until 5.2 which is meant to be released in April 2025. If your solution
runs into problems when dealing with subqueries and you want to double
down on this approach you should be able to identify the proper attributes
to used specialized logic.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35836#comment:2>