MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / within_group

Method within_group

lib/sqlalchemy/sql/functions.py:528–550  ·  view source on GitHub ↗

Produce a WITHIN GROUP (ORDER BY expr) clause against this function. Used against so-called "ordered set aggregate" and "hypothetical set aggregate" functions, including :class:`.percentile_cont`, :class:`.rank`, :class:`.dense_rank`, etc. This feature is typically

(
        self, *order_by: _ColumnExpressionArgument[Any]
    )

Source from the content-addressed store, hash-verified

526 return AggregateOrderBy(self, *order_by)
527
528 def within_group(
529 self, *order_by: _ColumnExpressionArgument[Any]
530 ) -> WithinGroup[_T]:
531 """Produce a WITHIN GROUP (ORDER BY expr) clause against this function.
532
533 Used against so-called "ordered set aggregate" and "hypothetical
534 set aggregate" functions, including :class:`.percentile_cont`,
535 :class:`.rank`, :class:`.dense_rank`, etc. This feature is typically
536 used by PostgreSQL, Oracle Database, and Microsoft SQL Server.
537
538 For simple ORDER BY expressions within aggregate functions on
539 PostgreSQL, MySQL/MariaDB, SQLite, see :func:`_sql.aggregate_order_by`.
540
541 See :func:`_expression.within_group` for a full description.
542
543 .. seealso::
544
545 :ref:`tutorial_functions_within_group` -
546 in the :ref:`unified_tutorial`
547
548
549 """
550 return WithinGroup(self, *order_by)
551
552 @overload
553 def filter(self) -> Self: ...

Callers

nothing calls this directly

Calls 1

WithinGroupClass · 0.85

Tested by

no test coverage detected