]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
allow CTE to be direct DML target
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 11 May 2021 12:39:24 +0000 (08:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 11 May 2021 12:39:24 +0000 (08:39 -0400)
commit07ab6441ea13be44f5aac6c53f2ab07369a082ac
tree4918bafb46577c55d7782ce4076f873b9681ab38
parent1a7d8005ccf4a48a3008caaf66b309be93287774
allow CTE to be direct DML target

Implemented support for a :class:`_sql.CTE` construct to be used directly
as the target of a :func:`_sql.delete` construct, i.e. "WITH ... AS cte
DELETE FROM cte". This appears to be a useful feature of SQL Server.

The CTE is now generally usable as a DML target table however
it's not clear if this syntax is valid beyond the use case of
DELETE itself.

Fixes: #6464
Change-Id: I3aac6fae2a1abb39bc0ffa87a044f5eb4f90f026
doc/build/changelog/unreleased_14/6464.rst [new file with mode: 0644]
lib/sqlalchemy/sql/selectable.py
test/sql/test_cte.py