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

Method __init__

lib/sqlalchemy/sql/elements.py:4255–4282  ·  view source on GitHub ↗
(
        self,
        element: ColumnElement[_T],
        partition_by: Optional[_ByArgument] = None,
        order_by: Optional[_ByArgument] = None,
        range_: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
        rows: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
        groups: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
    )

Source from the content-addressed store, hash-verified

4253 groups: Optional[typing_Tuple[_IntOrRange, _IntOrRange]]
4254
4255 def __init__(
4256 self,
4257 element: ColumnElement[_T],
4258 partition_by: Optional[_ByArgument] = None,
4259 order_by: Optional[_ByArgument] = None,
4260 range_: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
4261 rows: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
4262 groups: Optional[typing_Tuple[Optional[int], Optional[int]]] = None,
4263 ):
4264 self.element = element
4265 if order_by is not None:
4266 self.order_by = ClauseList(
4267 *util.to_list(order_by), _literal_as_text_role=roles.ByOfRole
4268 )
4269 if partition_by is not None:
4270 self.partition_by = ClauseList(
4271 *util.to_list(partition_by),
4272 _literal_as_text_role=roles.ByOfRole,
4273 )
4274
4275 if sum(bool(item) for item in (range_, rows, groups)) > 1:
4276 raise exc.ArgumentError(
4277 "only one of 'rows', 'range_', or 'groups' may be provided"
4278 )
4279 else:
4280 self.range_ = self._interpret_range(range_) if range_ else None
4281 self.rows = self._interpret_range(rows) if rows else None
4282 self.groups = self._interpret_range(groups) if groups else None
4283
4284 def __reduce__(self):
4285 return self.__class__, (

Callers

nothing calls this directly

Calls 3

_interpret_rangeMethod · 0.95
ClauseListClass · 0.85
sumClass · 0.85

Tested by

no test coverage detected