MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _regroup

Method _regroup

lib/sqlalchemy/sql/selectable.py:7228–7242  ·  view source on GitHub ↗
(
        self,
        fn: Callable[[Select[Unpack[TupleAny]]], Select[Unpack[TupleAny]]],
    )

Source from the content-addressed store, hash-verified

7226 return []
7227
7228 def _regroup(
7229 self,
7230 fn: Callable[[Select[Unpack[TupleAny]]], Select[Unpack[TupleAny]]],
7231 ) -> ScalarSelect[Any]:
7232
7233 assert isinstance(self.element, ScalarSelect)
7234 element = self.element.element
7235 if not isinstance(element, Select):
7236 raise exc.InvalidRequestError(
7237 "Can only apply this operation to a plain SELECT construct"
7238 )
7239 new_element = fn(element)
7240
7241 return_value = new_element.scalar_subquery()
7242 return return_value
7243
7244 def select(self) -> Select[bool]:
7245 r"""Return a SELECT of this :class:`_expression.Exists`.

Callers 4

correlateMethod · 0.95
correlate_exceptMethod · 0.95
select_fromMethod · 0.95
whereMethod · 0.95

Calls 1

scalar_subqueryMethod · 0.45

Tested by

no test coverage detected