diff --git a/ibis/backends/sql/compilers/base.py b/ibis/backends/sql/compilers/base.py index b1111094bf05..cc4003a98cbc 100644 --- a/ibis/backends/sql/compilers/base.py +++ b/ibis/backends/sql/compilers/base.py @@ -694,6 +694,7 @@ def fn(node, __unused__, **kwargs): lambda parsed, cte: parsed.with_( cte.args["alias"], as_=cte.args["this"], + recursive=isinstance(cte.parent, sge.With) and cte.parent.recursive, dialect=self.dialect, copy=False, ),