From ceb0eb44ce2da4b7161b7a115525ed6bccf08cbc Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Tue, 31 Jan 2023 21:20:26 +0100 Subject: Fixed typing of limit, offset and fetch to allow ``None``. Fixes: #9183 Change-Id: I1ac3e3698034826122ea8a0cdc9f8f55a10ed6c1 --- lib/sqlalchemy/orm/query.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/sqlalchemy/orm/query.py') diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index ad4b3abcf..4c182ebe6 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -116,6 +116,7 @@ if TYPE_CHECKING: from ..sql._typing import _ColumnsClauseArgument from ..sql._typing import _DMLColumnArgument from ..sql._typing import _JoinTargetArgument + from ..sql._typing import _LimitOffsetType from ..sql._typing import _MAYBE_ENTITY from ..sql._typing import _no_kw from ..sql._typing import _NOT_ENTITY @@ -2615,9 +2616,7 @@ class Query( @_generative @_assertions(_no_statement_condition) - def limit( - self: SelfQuery, limit: Union[int, _ColumnExpressionArgument[int]] - ) -> SelfQuery: + def limit(self: SelfQuery, limit: _LimitOffsetType) -> SelfQuery: """Apply a ``LIMIT`` to the query and return the newly resulting ``Query``. @@ -2631,9 +2630,7 @@ class Query( @_generative @_assertions(_no_statement_condition) - def offset( - self: SelfQuery, offset: Union[int, _ColumnExpressionArgument[int]] - ) -> SelfQuery: + def offset(self: SelfQuery, offset: _LimitOffsetType) -> SelfQuery: """Apply an ``OFFSET`` to the query and return the newly resulting ``Query``. -- cgit v1.2.1