diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-12-03 17:39:55 +0100 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-12-03 13:04:58 -0500 |
commit | c1b7600d9ec6cb29eb48455726799a6779704240 (patch) | |
tree | 263ba448ef4c72c9d7c9d0f30d328525b59bc93a /lib/sqlalchemy/sql/selectable.py | |
parent | 96db7cdd53ee9004be66545989b4ac5632bb7ccf (diff) | |
download | sqlalchemy-c1b7600d9ec6cb29eb48455726799a6779704240.tar.gz |
Order_by and group_by accept labels
Improve typing to accept labels in ordey_by mand group_by.
Change-Id: I33e5d6f64633d39a220108d412ef84d6478b25e6
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 2dcc611fa..fd4157afd 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -106,6 +106,7 @@ _T = TypeVar("_T", bound=Any) if TYPE_CHECKING: from ._typing import _ColumnExpressionArgument + from ._typing import _ColumnExpressionOrStrLabelArgument from ._typing import _FromClauseArgument from ._typing import _JoinTargetArgument from ._typing import _MAYBE_ENTITY @@ -4146,9 +4147,10 @@ class GenerativeSelect(SelectBase, Generative): def order_by( self: SelfGenerativeSelect, __first: Union[ - Literal[None, _NoArg.NO_ARG], _ColumnExpressionArgument[Any] + Literal[None, _NoArg.NO_ARG], + _ColumnExpressionOrStrLabelArgument[Any], ] = _NoArg.NO_ARG, - *clauses: _ColumnExpressionArgument[Any], + *clauses: _ColumnExpressionOrStrLabelArgument[Any], ) -> SelfGenerativeSelect: r"""Return a new selectable with the given list of ORDER BY criteria applied. @@ -4190,9 +4192,10 @@ class GenerativeSelect(SelectBase, Generative): def group_by( self: SelfGenerativeSelect, __first: Union[ - Literal[None, _NoArg.NO_ARG], _ColumnExpressionArgument[Any] + Literal[None, _NoArg.NO_ARG], + _ColumnExpressionOrStrLabelArgument[Any], ] = _NoArg.NO_ARG, - *clauses: _ColumnExpressionArgument[Any], + *clauses: _ColumnExpressionOrStrLabelArgument[Any], ) -> SelfGenerativeSelect: r"""Return a new selectable with the given list of GROUP BY criterion applied. |