]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add get_one to Session, AsyncSession, scoped, etc
authorCarlos Sousa <edu-eduardo99@hotmail.com>
Mon, 25 Sep 2023 17:03:26 +0000 (13:03 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 1 Oct 2023 13:07:44 +0000 (09:07 -0400)
commitdc8b7cb5fdb556d78145c1f67737671307f3604d
treec3b0b9bfe38a89f06d12b5b755193a0ff7fe4a0f
parentff80019212a5632c9dd01ef727648107636c32fa
Add get_one to Session, AsyncSession, scoped, etc

Added method :meth:`_orm.Session.get_one` that behaves like
meth:`_orm.Session.get` but raises an exception instead of returning
None`` if no instance was found with the provided primary key.
Pull request courtesy of Carlos Sousa.

Fixed the :paramref:`_asyncio.AsyncSession.get.execution_options` parameter
which was not being propagated to the underlying :class:`_orm.Session` and
was instead being ignored.

Fixes #10292
Closes: #10376
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10376
Pull-request-sha: 70e4505e93905ee3cebc52f828a95c6bf987c9be

Change-Id: I78eb9816c26446757b6c6c171df2e400777a3d36
doc/build/changelog/unreleased_20/10292.rst [new file with mode: 0644]
lib/sqlalchemy/ext/asyncio/scoping.py
lib/sqlalchemy/ext/asyncio/session.py
lib/sqlalchemy/orm/scoping.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/util/langhelpers.py
test/ext/asyncio/test_session_py3k.py
test/ext/test_horizontal_shard.py
test/orm/test_query.py
test/orm/test_session.py
tools/generate_proxy_methods.py