]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Improve async session docs.
authorFederico Caselli <cfederico87@gmail.com>
Wed, 23 Dec 2020 21:18:36 +0000 (22:18 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Wed, 23 Dec 2020 21:18:36 +0000 (22:18 +0100)
Mention that the context manager is only for convenience, that it's equivalent
to calling ``close()``

Change-Id: Ic186167cc3d4bbd7a24701dd6169ed0d515c5dc5

doc/build/orm/extensions/asyncio.rst
doc/build/orm/session_basics.rst

index a22529ec5e716e1d5b524a1a03d65db312ec80b9..09e76f2ee449f4f372445ed920ab19dbbc19c18e 100644 (file)
@@ -143,6 +143,12 @@ avoided in favor of :meth:`_asyncio.AsyncSession.refresh`, and that
 appropriate loader options should be employed for :func:`_orm.deferred`
 columns as well as for :func:`_orm.relationship` constructs.
 
+In the example above the :class:`_asyncio.AsyncSession` is instantiated with an
+:class:`_asyncio.AsyncEngine` associated with a particular database URL.
+It is then used in a Python asynchronous context manager (i.e. ``async with:`` statement)
+so that it is automatically closed at the end of the block; this is equivalent
+to calling the :meth:`_asyncio.AsyncSession.close` method.
+
 Adapting ORM Lazy loads to asyncio
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index d7fa9c81ab487b98e5c1bf54212af868cad51535..23a76b4d01afe36e8584e8740baa5919ca0180f4 100644 (file)
@@ -69,7 +69,7 @@ may look like::
         session.add(some_other_object)
         session.commit()
 
-Above, the :class:`_orm.Session` is instantiated given an :class:`_engine.Engine`
+Above, the :class:`_orm.Session` is instantiated with an :class:`_engine.Engine`
 associated with a particular database URL.   It is then used in a Python
 context manager (i.e. ``with:`` statement) so that it is automatically
 closed at the end of the block; this is equivalent