]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Implement nesting CTE
authorEric Masseran <eric.masseran@gmail.com>
Mon, 13 Sep 2021 17:45:57 +0000 (13:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Sep 2021 15:55:48 +0000 (11:55 -0400)
commita3884f36f691df81fb5a1c795fe7ecc0c83507b6
tree4a512ccdf713a87cc1e4a0b2a79208d712daa118
parentf85dd7b9f1ca4ba30f58d939b2ae003feaa34c8f
Implement nesting CTE

Added new parameter :meth:`_sql.HasCte.cte.nesting` to the
:class:`_sql.CTE` constructor and :meth:`_sql.HasCTE.cte` method, which
flags the CTE as one which should remain nested within an enclosing CTE,
rather than being moved to the top level of the outermost SELECT. While in
the vast majority of cases there is no difference in SQL functionality,
users have identified various edge-cases where true nesting of CTE
constructs is desirable. Much thanks to Eric Masseran for lots of work on
this intricate feature.

Fixes: #4123
Closes: #6709
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6709
Pull-request-sha: 64ab2f6ea269f2dcf37376a13ea38c48c5226fb6

Change-Id: Ic4dc25ab763af96d96632369e01527d48a654149
doc/build/changelog/unreleased_14/4132.rst [new file with mode: 0644]
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/selectable.py
test/sql/test_cte.py