summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/session.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-01-06 10:46:29 +0100
committerFederico Caselli <cfederico87@gmail.com>2021-01-07 21:40:48 +0000
commit97cb27777aff9797c16271022f104f39c38f2418 (patch)
tree08a63729242674a559a4a6d3b90da37b57bd6507 /lib/sqlalchemy/ext/asyncio/session.py
parentb45aa7c4062bafae23286c3069571c2596aabc66 (diff)
downloadsqlalchemy-97cb27777aff9797c16271022f104f39c38f2418.tar.gz
Improve ``run_sync`` documentation in asyncio ext
Change-Id: I202458ab6d81e29053118c9fb9c205b865c8d2ba Ref: #5817
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
-rw-r--r--lib/sqlalchemy/ext/asyncio/session.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py
index 9a8284e64..faa279cf9 100644
--- a/lib/sqlalchemy/ext/asyncio/session.py
+++ b/lib/sqlalchemy/ext/asyncio/session.py
@@ -121,6 +121,16 @@ class AsyncSession:
with AsyncSession(async_engine) as session:
await session.run_sync(some_business_method)
+ .. note::
+
+ The provided callable is invoked inline within the asyncio event
+ loop, and will block on traditional IO calls. IO within this
+ callable should only call into SQLAlchemy's asyncio database
+ APIs which will be properly adapted to the greenlet context.
+
+ .. seealso::
+
+ :ref:`session_run_sync`
"""
return await greenlet_spawn(fn, self.sync_session, *arg, **kw)