]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
use scalars().one() for count migration
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 30 Jan 2023 14:02:33 +0000 (09:02 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 30 Jan 2023 14:02:33 +0000 (09:02 -0500)
so that the typed result is non-optional

Fixes: #9184
Change-Id: I40e655010d08f795f3b835b9327ce50c6ec72135

doc/build/changelog/migration_20.rst

index 41a3e36368be0be85882b0731b0a6dcf89b12cf0..51e34955ee46328656eda5a41ad9c516121b172e 100644 (file)
@@ -1518,13 +1518,13 @@ following the table, and may include additional notes not summarized here.
 
       - ::
 
-          session.scalar(
+          session.scalars(
             select(func.count()).
             select_from(User)
-          )
-          session.scalar(
+          ).one()
+          session.scalars(
             select(func.count(User.id))
-          )
+          ).one()
 
       - :meth:`_orm.Session.scalar`