diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-05-10 11:08:07 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-05-10 15:24:11 -0400 |
commit | 189039b9d38343b482f1b077bbcf6f6ae99cbacd (patch) | |
tree | a4f853e10dd00ae2de18e8a32139b925dfcbd2c5 /lib/sqlalchemy/ext/asyncio | |
parent | 987285fb4b13c39bcc6b8922e618d9e830577dda (diff) | |
download | sqlalchemy-189039b9d38343b482f1b077bbcf6f6ae99cbacd.tar.gz |
add full parameter types for ORM with_for_update
Fixed typing for the :paramref:`_orm.Session.get.with_for_update` parameter
of :meth:`_orm.Session.get` and :meth:`_orm.Session.refresh` (as well as
corresponding methods on :class:`_asyncio.AsyncSession`) to accept boolean
``True`` and all other argument forms accepted by the parameter at runtime.
Fixes: #9762
Change-Id: Ied4d37a269906b3d9be5ab7d31a2fa863360cced
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio')
-rw-r--r-- | lib/sqlalchemy/ext/asyncio/scoping.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/asyncio/session.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/scoping.py b/lib/sqlalchemy/ext/asyncio/scoping.py index 52eeb0828..49d8b3af9 100644 --- a/lib/sqlalchemy/ext/asyncio/scoping.py +++ b/lib/sqlalchemy/ext/asyncio/scoping.py @@ -55,7 +55,7 @@ if TYPE_CHECKING: from ...orm.session import _SessionBind from ...sql.base import Executable from ...sql.elements import ClauseElement - from ...sql.selectable import ForUpdateArg + from ...sql.selectable import ForUpdateParameter from ...sql.selectable import TypedReturnsRows _T = TypeVar("_T", bound=Any) @@ -217,7 +217,7 @@ class async_scoped_session(Generic[_AS]): *, options: Optional[Sequence[ORMOption]] = None, populate_existing: bool = False, - with_for_update: Optional[ForUpdateArg] = None, + with_for_update: ForUpdateParameter = None, identity_token: Optional[Any] = None, execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT, ) -> Optional[_O]: @@ -934,7 +934,7 @@ class async_scoped_session(Generic[_AS]): self, instance: object, attribute_names: Optional[Iterable[str]] = None, - with_for_update: Optional[ForUpdateArg] = None, + with_for_update: ForUpdateParameter = None, ) -> None: r"""Expire and refresh the attributes on the given instance. diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py index 00fee9716..615003302 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -62,7 +62,7 @@ if TYPE_CHECKING: from ...sql._typing import _InfoType from ...sql.base import Executable from ...sql.elements import ClauseElement - from ...sql.selectable import ForUpdateArg + from ...sql.selectable import ForUpdateParameter from ...sql.selectable import TypedReturnsRows _AsyncSessionBind = Union["AsyncEngine", "AsyncConnection"] @@ -301,7 +301,7 @@ class AsyncSession(ReversibleProxy[Session]): self, instance: object, attribute_names: Optional[Iterable[str]] = None, - with_for_update: Optional[ForUpdateArg] = None, + with_for_update: ForUpdateParameter = None, ) -> None: """Expire and refresh the attributes on the given instance. @@ -566,7 +566,7 @@ class AsyncSession(ReversibleProxy[Session]): *, options: Optional[Sequence[ORMOption]] = None, populate_existing: bool = False, - with_for_update: Optional[ForUpdateArg] = None, + with_for_update: ForUpdateParameter = None, identity_token: Optional[Any] = None, execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT, ) -> Optional[_O]: |