MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / over

Method over

lib/sqlalchemy/sql/functions.py:458–500  ·  view source on GitHub ↗

Produce an OVER clause against this function. Used against aggregate or so-called "window" functions, for database backends that support window functions. The expression:: func.row_number().over(order_by="x") is shorthand for:: from sqlalc

(
        self,
        *,
        partition_by: _ByArgument | None = None,
        order_by: _ByArgument | None = None,
        rows: _FrameIntTuple | FrameClause | None = None,
        range_: _FrameIntTuple | FrameClause | None = None,
        groups: _FrameIntTuple | FrameClause | None = None,
        exclude: str | None = None,
    )

Source from the content-addressed store, hash-verified

456 return cast(ClauseList, self.clause_expr.element)
457
458 def over(
459 self,
460 *,
461 partition_by: _ByArgument | None = None,
462 order_by: _ByArgument | None = None,
463 rows: _FrameIntTuple | FrameClause | None = None,
464 range_: _FrameIntTuple | FrameClause | None = None,
465 groups: _FrameIntTuple | FrameClause | None = None,
466 exclude: str | None = None,
467 ) -> Over[_T]:
468 """Produce an OVER clause against this function.
469
470 Used against aggregate or so-called "window" functions,
471 for database backends that support window functions.
472
473 The expression::
474
475 func.row_number().over(order_by="x")
476
477 is shorthand for::
478
479 from sqlalchemy import over
480
481 over(func.row_number(), order_by="x")
482
483 See :func:`_expression.over` for a full description.
484
485 .. seealso::
486
487 :func:`_expression.over`
488
489 :ref:`tutorial_window_functions` - in the :ref:`unified_tutorial`
490
491 """
492 return Over(
493 self,
494 partition_by=partition_by,
495 order_by=order_by,
496 rows=rows,
497 range_=range_,
498 groups=groups,
499 exclude=exclude,
500 )
501
502 def aggregate_order_by(
503 self, *order_by: _ColumnExpressionArgument[Any]

Callers

nothing calls this directly

Calls 1

OverClass · 0.85

Tested by

no test coverage detected