r"""Return a new :class:`_expression.CTE` with a SQL ``UNION`` 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 elemen
(
self, *other: _SelectStatementForCompoundArgument[Any]
)
| 2297 | ) |
| 2298 | |
| 2299 | def union( |
| 2300 | self, *other: _SelectStatementForCompoundArgument[Any] |
| 2301 | ) -> CTE[_KeyColCC_co]: |
| 2302 | r"""Return a new :class:`_expression.CTE` with a SQL ``UNION`` |
| 2303 | of the original CTE against the given selectables provided |
| 2304 | as positional arguments. |
| 2305 | |
| 2306 | :param \*other: one or more elements with which to create a |
| 2307 | UNION. |
| 2308 | |
| 2309 | .. versionchanged:: 1.4.28 multiple elements are now accepted. |
| 2310 | |
| 2311 | .. seealso:: |
| 2312 | |
| 2313 | :meth:`_sql.HasCTE.cte` - examples of calling styles |
| 2314 | |
| 2315 | """ |
| 2316 | assert is_select_statement( |
| 2317 | self.element |
| 2318 | ), f"CTE element f{self.element} does not support union()" |
| 2319 | |
| 2320 | return CTE._construct( |
| 2321 | self.element.union(*other), |
| 2322 | name=self.name, |
| 2323 | recursive=self.recursive, |
| 2324 | nesting=self.nesting, |
| 2325 | _restates=self, |
| 2326 | _prefixes=self._prefixes, |
| 2327 | _suffixes=self._suffixes, |
| 2328 | ) |
| 2329 | |
| 2330 | def union_all( |
| 2331 | self, *other: _SelectStatementForCompoundArgument[Any] |
no test coverage detected