MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / SelectStatementGrouping

Class SelectStatementGrouping

lib/sqlalchemy/sql/selectable.py:3979–4083  ·  view source on GitHub ↗

Represent a grouping of a :class:`_expression.SelectBase`. This differs from :class:`.Subquery` in that we are still an "inner" SELECT statement, this is strictly for grouping inside of compound selects.

Source from the content-addressed store, hash-verified

3977
3978
3979class SelectStatementGrouping(GroupedElement, SelectBase, Generic[_SB]):
3980 """Represent a grouping of a :class:`_expression.SelectBase`.
3981
3982 This differs from :class:`.Subquery` in that we are still
3983 an "inner" SELECT statement, this is strictly for grouping inside of
3984 compound selects.
3985
3986 """
3987
3988 __visit_name__ = "select_statement_grouping"
3989 _traverse_internals: _TraverseInternalsType = [
3990 ("element", InternalTraversal.dp_clauseelement)
3991 ] + SupportsCloneAnnotations._clone_annotations_traverse_internals
3992
3993 _is_select_container = True
3994
3995 element: _SB
3996
3997 def __init__(self, element: _SB) -> None:
3998 self.element = cast(
3999 _SB, coercions.expect(roles.SelectStatementRole, element)
4000 )
4001
4002 def _ensure_disambiguated_names(self) -> SelectStatementGrouping[_SB]:
4003 new_element = self.element._ensure_disambiguated_names()
4004 if new_element is not self.element:
4005 return SelectStatementGrouping(new_element)
4006 else:
4007 return self
4008
4009 def get_label_style(self) -> SelectLabelStyle:
4010 return self.element.get_label_style()
4011
4012 def set_label_style(
4013 self, label_style: SelectLabelStyle
4014 ) -> SelectStatementGrouping[_SB]:
4015 return SelectStatementGrouping(
4016 self.element.set_label_style(label_style)
4017 )
4018
4019 @property
4020 def select_statement(self) -> _SB:
4021 return self.element
4022
4023 def self_group(self, against: Optional[OperatorType] = None) -> Self:
4024 return self
4025
4026 if TYPE_CHECKING:
4027
4028 def _ungroup(self) -> _SB: ...
4029
4030 # def _generate_columns_plus_names(
4031 # self, anon_for_dupe_key: bool
4032 # ) -> List[Tuple[str, str, str, ColumnElement[Any], bool]]:
4033 # return self.element._generate_columns_plus_names(anon_for_dupe_key)
4034
4035 def _generate_fromclause_column_proxies(
4036 self,

Calls

no outgoing calls