MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / union_all

Method union_all

lib/sqlalchemy/sql/selectable.py:2330–2360  ·  view source on GitHub ↗

r"""Return a new :class:`_expression.CTE` with a SQL ``UNION ALL`` of the original CTE against the given selectables provided as positional arguments. :param \*other: one or more elements with which to create a UNION. .. versionchanged:: 1.4.28 multiple el

(
        self, *other: _SelectStatementForCompoundArgument[Any]
    )

Source from the content-addressed store, hash-verified

2328 )
2329
2330 def union_all(
2331 self, *other: _SelectStatementForCompoundArgument[Any]
2332 ) -> CTE[_KeyColCC_co]:
2333 r"""Return a new :class:`_expression.CTE` with a SQL ``UNION ALL``
2334 of the original CTE against the given selectables provided
2335 as positional arguments.
2336
2337 :param \*other: one or more elements with which to create a
2338 UNION.
2339
2340 .. versionchanged:: 1.4.28 multiple elements are now accepted.
2341
2342 .. seealso::
2343
2344 :meth:`_sql.HasCTE.cte` - examples of calling styles
2345
2346 """
2347
2348 assert is_select_statement(
2349 self.element
2350 ), f"CTE element f{self.element} does not support union_all()"
2351
2352 return CTE._construct(
2353 self.element.union_all(*other),
2354 name=self.name,
2355 recursive=self.recursive,
2356 nesting=self.nesting,
2357 _restates=self,
2358 _prefixes=self._prefixes,
2359 _suffixes=self._suffixes,
2360 )
2361
2362 def _get_reference_cte(self) -> CTE[_KeyColCC_co]:
2363 """

Callers

nothing calls this directly

Calls 2

is_select_statementFunction · 0.85
_constructMethod · 0.45

Tested by

no test coverage detected