MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / union

Method union

lib/sqlalchemy/sql/selectable.py:2245–2272  ·  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

2243 )
2244
2245 def union(self, *other: _SelectStatementForCompoundArgument[Any]) -> CTE:
2246 r"""Return a new :class:`_expression.CTE` with a SQL ``UNION``
2247 of the original CTE against the given selectables provided
2248 as positional arguments.
2249
2250 :param \*other: one or more elements with which to create a
2251 UNION.
2252
2253 .. versionchanged:: 1.4.28 multiple elements are now accepted.
2254
2255 .. seealso::
2256
2257 :meth:`_sql.HasCTE.cte` - examples of calling styles
2258
2259 """
2260 assert is_select_statement(
2261 self.element
2262 ), f"CTE element f{self.element} does not support union()"
2263
2264 return CTE._construct(
2265 self.element.union(*other),
2266 name=self.name,
2267 recursive=self.recursive,
2268 nesting=self.nesting,
2269 _restates=self,
2270 _prefixes=self._prefixes,
2271 _suffixes=self._suffixes,
2272 )
2273
2274 def union_all(
2275 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