I have written a DEP about planned ORM expressions API changes. See
https://github.com/django/deps/pull/5 for the proposed DEP.
The plan is to throw away sql.expressions.SQLEvaluator, rewrite how
expressions work and make aggregates subclasses of expressions.
Short summary of the goals and problems of the DEP:
- The aim is to allow writing custom expressions through public API,
allow usage of F() expressions in annotations and doing arithmetic
operations on aggregates
- Simplify coding of the ORM
- The DEP is based on work done by Josh Smeaton in pull request
https://github.com/django/django/pull/2496. While the patch will solve
multiple issues, the main ticket tracking these changes is #14030.
- The main problem is backwards compatibility - writing custom
expressions or non-SQL backends requires usage of private APIs. The DEP
aims to change those private APIs.
I am planning to actually include the DEP as a draft in the django/deps
repository once the most problematic pats of the draft have been
rewritten. Once committed into the django/deps repository collaboration
on the DEP will be much easier.
As there isn't currently any process for actually accepting DEPs it
might be possible that we need to move on with Josh Smeaton's work
before the DEP is formally accepted. Of course, I hope that we get the
DEP process going on, so we can first accept the DEP, then commit the
actual implementation.
Comments on the ORM epressions API changes should go to the pull request
for now. Comments on the DEP process itself are welcome here.
- Anssi