MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / Over

Class Over

lib/sqlalchemy/sql/elements.py:4511–4601  ·  view source on GitHub ↗

Represent an OVER clause. This is a special operator against a so-called "window" function, as well as any aggregate function, which produces results relative to the result set itself. Most modern SQL backends now support window functions.

Source from the content-addressed store, hash-verified

4509
4510
4511class Over(ColumnElement[_T]):
4512 """Represent an OVER clause.
4513
4514 This is a special operator against a so-called
4515 "window" function, as well as any aggregate function,
4516 which produces results relative to the result set
4517 itself. Most modern SQL backends now support window functions.
4518
4519 """
4520
4521 __visit_name__ = "over"
4522
4523 _traverse_internals: _TraverseInternalsType = [
4524 ("element", InternalTraversal.dp_clauseelement),
4525 ("order_by", InternalTraversal.dp_clauseelement),
4526 ("partition_by", InternalTraversal.dp_clauseelement),
4527 ("range_", InternalTraversal.dp_clauseelement),
4528 ("rows", InternalTraversal.dp_clauseelement),
4529 ("groups", InternalTraversal.dp_clauseelement),
4530 ("exclude", InternalTraversal.dp_string),
4531 ]
4532
4533 order_by: Optional[ClauseList] = None
4534 partition_by: Optional[ClauseList] = None
4535
4536 element: ColumnElement[_T]
4537 """The underlying expression object to which this :class:`.Over`
4538 object refers."""
4539
4540 range_: FrameClause | None
4541 rows: FrameClause | None
4542 groups: FrameClause | None
4543 exclude: str | None
4544
4545 def __init__(
4546 self,
4547 element: ColumnElement[_T],
4548 partition_by: Optional[_ByArgument] = None,
4549 order_by: Optional[_ByArgument] = None,
4550 range_: _FrameIntTuple | FrameClause | None = None,
4551 rows: _FrameIntTuple | FrameClause | None = None,
4552 groups: _FrameIntTuple | FrameClause | None = None,
4553 exclude: str | None = None,
4554 ):
4555 self.element = element
4556 if order_by is not None:
4557 self.order_by = ClauseList(
4558 *util.to_list(order_by), _literal_as_text_role=roles.ByOfRole
4559 )
4560 if partition_by is not None:
4561 self.partition_by = ClauseList(
4562 *util.to_list(partition_by),
4563 _literal_as_text_role=roles.ByOfRole,
4564 )
4565
4566 if sum(item is not None for item in (range_, rows, groups)) > 1:
4567 raise exc.ArgumentError(
4568 "only one of 'rows', 'range_', or 'groups' may be provided"

Callers 4

overMethod · 0.85
overMethod · 0.85
overMethod · 0.85
overFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected