From: Reuven Starodubski Date: Thu, 11 Sep 2025 17:29:08 +0000 (+0300) Subject: fix comment X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d93fb591751227eb1f96052ea3ad449f511f70b3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fix comment --- diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py index 955b1761ee..1bd20fea29 100644 --- a/lib/sqlalchemy/dialects/postgresql/ext.py +++ b/lib/sqlalchemy/dialects/postgresql/ext.py @@ -17,6 +17,7 @@ from typing import TypeVar from . import types from .array import ARRAY +from ...sql import aggregate_order_by as aggregate_order_by_core from ...sql import coercions from ...sql import elements from ...sql import expression @@ -39,51 +40,8 @@ if TYPE_CHECKING: _T = TypeVar("_T", bound=Any) -class aggregate_order_by(elements.AggregateOrderBy[_T]): - """Represent an aggregate order by expression. - - .. deprecated:: 2.0.X - The PostgreSQL-specific :class:`aggregate_order_by` is deprecated. - Please use :func:`sqlalchemy.sql.expression.aggregate_order_by` instead, - which is now available as core functionality. - - E.g.:: - - from sqlalchemy.dialects.postgresql import aggregate_order_by - - expr = func.array_agg(aggregate_order_by(table.c.a, table.c.b.desc())) - stmt = select(expr) - - would represent the expression: - - .. sourcecode:: sql - - SELECT array_agg(a ORDER BY b DESC) FROM table; - - Similarly:: - - expr = func.string_agg( - table.c.a, aggregate_order_by(literal_column("','"), table.c.a) - ) - stmt = select(expr) - - Would represent: - - .. sourcecode:: sql - - SELECT string_agg(a, ',' ORDER BY a) FROM table; - - .. versionchanged:: 1.2.13 - the ORDER BY argument may be multiple terms - - .. versionchanged:: 2.0.X - moved to core functionality as :func:`sqlalchemy.sql.expression.aggregate_order_by` - - .. seealso:: - - :func:`sqlalchemy.sql.expression.aggregate_order_by` - - :class:`_functions.array_agg` - - """ +def aggregate_order_by(target: expression.ColumnElement[_T], *order_by: expression.ColumnElement[_T]): + return aggregate_order_by_core(target, *order_by) class ExcludeConstraint(ColumnCollectionConstraint): """A table-level EXCLUDE constraint.