pypika
pypika copied to clipboard
Recursive CTE
Is there a way to do
WITH
RECURSIVE table(column1, column2) AS (SELECT this, that FROM somewhere)
UNION
SELECT column1, column2 FROM table
SELECT
column1, column2
FROM
table
I know how to build UNION from #359, but I couldn't see a way to have RECURSIVE keyword in the query. https://github.com/kayak/pypika/blob/920a4cdd99cbcd85d55af2d8d2c601d8bef8bfc2/pypika/queries.py#L1356-L1360 Or do I read the wrong part of the code?
Also, I don't know how to do table(column1, column2)
in the WITH statement. Should just I use as_
in the following SELECT as a workaround, or is there any other way? Table
or Field
does not seems to fit to me either.
Thanks