]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add ``scalars`` to Migration - ORM Usage table.
authorFederico Caselli <cfederico87@gmail.com>
Thu, 9 Dec 2021 21:41:47 +0000 (22:41 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 9 Dec 2021 21:41:47 +0000 (22:41 +0100)
Fixes #7407

Change-Id: I0ec7c0dd44dce3b907296824ee4e6103bc72a6dd

doc/build/changelog/migration_20.rst

index 5fdd093d0b7ec94e9a2fe285076e8d998a22f694..2ec9bc858fa48bc474847510345e8a2d48f15cd8 100644 (file)
@@ -1289,9 +1289,12 @@ following the table, and may include additional notes not summarized here.
           session.execute(
               select(User)
           ).scalars().all()
+          # or
+          session.scalars(select(User)).all()
 
       - :ref:`migration_20_unify_select`
 
+        :meth:`_orm.Session.scalars`
         :meth:`_engine.Result.scalars`
 
     * - ::
@@ -1318,11 +1321,11 @@ following the table, and may include additional notes not summarized here.
 
       - ::
 
-          session.execute(
+          session.scalars(
             select(User).
             filter_by(name="some user").
             limit(1)
-          ).scalars().first()
+          ).first()
 
       - :ref:`migration_20_unify_select`
 
@@ -1336,7 +1339,7 @@ following the table, and may include additional notes not summarized here.
 
       - ::
 
-            session.execute(
+            session.scalars(
                 select(User).
                 options(
                   joinedload(User.addresses)
@@ -1372,12 +1375,12 @@ following the table, and may include additional notes not summarized here.
 
       - ::
 
-          session.execute(
+          session.scalars(
               select(User).
               from_statement(
                   text("select * from users")
               )
-          ).scalars().all()
+          ).all()
 
       - :ref:`orm_queryguide_selecting_text`