From: Mike Bayer Date: Fri, 26 Mar 2021 18:39:22 +0000 (-0400) Subject: Add ScopedSession.get() X-Git-Tag: rel_1_4_4~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f78900abb34dc8139debbe2c7070fb488414e47;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add ScopedSession.get() Fixed missing method :meth:`_orm.Session.get` from the :class:`_orm.ScopedSession` interface. Fixes: #6144 Change-Id: I1d2425675f7f972c2479070a2e11b1d96a9aca8b --- diff --git a/doc/build/changelog/unreleased_14/6144.rst b/doc/build/changelog/unreleased_14/6144.rst new file mode 100644 index 0000000000..49f9e0da3d --- /dev/null +++ b/doc/build/changelog/unreleased_14/6144.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: bug, regression, orm + :tickets: 6144 + + Fixed missing method :meth:`_orm.Session.get` from the + :class:`_orm.ScopedSession` interface. + diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index 6aef243c76..0ba7b12ff2 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -39,6 +39,7 @@ __all__ = ["scoped_session"] "expunge", "expunge_all", "flush", + "get", "get_bind", "is_modified", "bulk_save_objects", diff --git a/test/orm/test_scoping.py b/test/orm/test_scoping.py index 5386fd1127..60ad0285f4 100644 --- a/test/orm/test_scoping.py +++ b/test/orm/test_scoping.py @@ -138,11 +138,19 @@ class ScopedSessionTest(fixtures.MappedTest): sess.add("add") sess.delete("delete") + sess.get("Cls", 5) + eq_(sess.bind, "the bind") eq_( mock_session.mock_calls, - [mock.call.add("add", True), mock.call.delete("delete")], + [ + mock.call.add("add", True), + mock.call.delete("delete"), + mock.call.get( + "Cls", 5, mock.ANY, mock.ANY, mock.ANY, mock.ANY + ), + ], ) with mock.patch(