diff options
author | Eric Masseran <eric.masseran@gmail.com> | 2021-11-02 16:40:04 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-16 14:44:36 -0500 |
commit | 958f902b1fc528fed0be550bc573545de47ed854 (patch) | |
tree | 806989f5c2fe6f3a2480b6f878aa11db0eed92ca /lib/sqlalchemy/dialects/postgresql/asyncpg.py | |
parent | 6206f0ff74e95c9339dc0f0e26caab55e9bcda45 (diff) | |
download | sqlalchemy-958f902b1fc528fed0be550bc573545de47ed854.tar.gz |
Add Non linear CTE support
"Compound select" methods like :meth:`_sql.Select.union`,
:meth:`_sql.Select.intersect_all` etc. now accept ``*other`` as an argument
rather than ``other`` to allow for multiple additional SELECTs to be
compounded with the parent statement at once. In particular, the change as
applied to :meth:`_sql.CTE.union` and :meth:`_sql.CTE.union_all` now allow
for a so-called "non-linear CTE" to be created with the :class:`_sql.CTE`
construct, whereas previously there was no way to have more than two CTE
sub-elements in a UNION together while still correctly calling upon the CTE
in recursive fashion. Pull request courtesy Eric Masseran.
Allow:
```sql
WITH RECURSIVE nodes(x) AS (
SELECT 59
UNION
SELECT aa FROM edge JOIN nodes ON bb=x
UNION
SELECT bb FROM edge JOIN nodes ON aa=x
)
SELECT x FROM nodes;
```
Based on @zzzeek suggestion: https://github.com/sqlalchemy/sqlalchemy/pull/7133#issuecomment-933882348
Fixes: #7259
Closes: #7260
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7260
Pull-request-sha: 2565a5fd4b1940e92125e53aeaa731cc682f49bb
Change-Id: I685c8379762b5fb6ab4107ff8f4d8a4de70c0ca6
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
0 files changed, 0 insertions, 0 deletions