]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add ScopedSession.get()
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 Mar 2021 18:39:22 +0000 (14:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 Mar 2021 18:39:22 +0000 (14:39 -0400)
Fixed missing method :meth:`_orm.Session.get` from the
:class:`_orm.ScopedSession` interface.

Fixes: #6144
Change-Id: I1d2425675f7f972c2479070a2e11b1d96a9aca8b

doc/build/changelog/unreleased_14/6144.rst [new file with mode: 0644]
lib/sqlalchemy/orm/scoping.py
test/orm/test_scoping.py

diff --git a/doc/build/changelog/unreleased_14/6144.rst b/doc/build/changelog/unreleased_14/6144.rst
new file mode 100644 (file)
index 0000000..49f9e0d
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, regression, orm
+    :tickets: 6144
+
+    Fixed missing method :meth:`_orm.Session.get` from the
+    :class:`_orm.ScopedSession` interface.
+
index 6aef243c76da5ee2682d2a68cb4a2e525ad0a9ef..0ba7b12ff24691d4e1cc99f3594887ace6466df5 100644 (file)
@@ -39,6 +39,7 @@ __all__ = ["scoped_session"]
         "expunge",
         "expunge_all",
         "flush",
+        "get",
         "get_bind",
         "is_modified",
         "bulk_save_objects",
index 5386fd1127349fa38d22fd5f26ccd09480cab904..60ad0285f444bac6d6e5c0976379d2873605cf7d 100644 (file)
@@ -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(