MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / union

Method union

lib/sqlalchemy/sql/selectable.py:2299–2328  ·  view source on GitHub ↗

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]
    )

Source from the content-addressed store, hash-verified

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]

Callers 15

_with_hintMethod · 0.45
operateMethod · 0.45
reverse_operateMethod · 0.45
with_variantMethod · 0.45
proxy_setMethod · 0.45
return_defaultsMethod · 0.45
with_hintMethod · 0.45
valuesMethod · 0.45
__len__Method · 0.45
__iter__Method · 0.45

Calls 2

is_select_statementFunction · 0.85
_constructMethod · 0.45

Tested by

no test coverage detected