]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement multi-element expression constructs
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 12 Apr 2022 17:52:31 +0000 (13:52 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 Apr 2022 21:19:31 +0000 (17:19 -0400)
commit428262a2d5374613f4a4cf925bbd9e94e0e34acc
tree9f71ec4a09d3ea584b3e399085254fb278049a6f
parenta45e2284dad17fbbba3bea9d5e5304aab21c8c94
implement multi-element expression constructs

Improved the construction of SQL binary expressions to allow for very long
expressions against the same associative operator without special steps
needed in order to avoid high memory use and excess recursion depth. A
particular binary operation ``A op B`` can now be joined against another
element ``op C`` and the resulting structure will be "flattened" so that
the representation as well as SQL compilation does not require recursion.

To implement this more cleanly, the biggest change here is that
column-oriented lists of things are broken away from ClauseList
in a new class ExpressionClauseList, that also forms the basis
of BooleanClauseList. ClauseList is still used for the generic
"comma-separated list" of things such as Tuple and things like
ORDER BY, as well as in some API endpoints.

Also adds __slots__ to the TypeEngine-bound Comparator
classes.   Still can't really do __slots__ on ClauseElement.

Fixes: #7744
Change-Id: I81a8ceb6f8f3bb0fe52d58f3cb42e4b6c2bc9018
15 files changed:
doc/build/changelog/unreleased_20/7744.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/postgresql/array.py
lib/sqlalchemy/orm/evaluator.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/default_comparator.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/testing/suite/test_types.py
test/dialect/mysql/test_compiler.py
test/sql/test_operators.py