From edcaa54927af8d6ecc66a0d97d60e0cb785a6e7a Mon Sep 17 00:00:00 2001 From: Daniel Sam Date: Fri, 6 Feb 2026 14:45:02 +0530 Subject: [PATCH] =?utf8?q?=F0=9F=93=9D=20Fix=20async=20example=20in=20`ses?= =?utf8?q?sion.execute()`=20docstring=20&=20deprecation=20message=20(#1643?= =?utf8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix async example in session.execute() deprecation warning & docstring Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com> --- sqlmodel/ext/asyncio/session.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sqlmodel/ext/asyncio/session.py b/sqlmodel/ext/asyncio/session.py index 056737f8..11e99ed8 100644 --- a/sqlmodel/ext/asyncio/session.py +++ b/sqlmodel/ext/asyncio/session.py @@ -116,13 +116,15 @@ class AsyncSession(_AsyncSession): For example: ```Python - heroes = await session.execute(select(Hero)).scalars().all() + result = await session.execute(select(Hero)) + heroes = result.scalars().all() ``` instead you could use `exec()`: ```Python - heroes = await session.exec(select(Hero)).all() + result = await session.exec(select(Hero)) + heroes = result.all() ``` """ ) @@ -145,13 +147,15 @@ class AsyncSession(_AsyncSession): For example: ```Python - heroes = await session.execute(select(Hero)).scalars().all() + result = await session.execute(select(Hero)) + heroes = result.scalars().all() ``` instead you could use `exec()`: ```Python - heroes = await session.exec(select(Hero)).all() + result = await session.exec(select(Hero)) + heroes = result.all() ``` """ return await super().execute( -- 2.47.3