From: Mike Bayer Date: Mon, 30 Jan 2023 14:02:33 +0000 (-0500) Subject: use scalars().one() for count migration X-Git-Tag: rel_1_4_47~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=629d156e94f2f70f42582d7e86ae89b8f242d708;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git use scalars().one() for count migration so that the typed result is non-optional Fixes: #9184 Change-Id: I40e655010d08f795f3b835b9327ce50c6ec72135 (cherry picked from commit 956f152a29632afacacc4ea11dce1a54a7afb3ea) --- diff --git a/doc/build/changelog/migration_20.rst b/doc/build/changelog/migration_20.rst index 7e567cbe60..8f7b45c3e4 100644 --- a/doc/build/changelog/migration_20.rst +++ b/doc/build/changelog/migration_20.rst @@ -1449,13 +1449,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`