Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ri-gilfanov committed Apr 20, 2021
1 parent a762c62 commit 8e4d329
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Overview

SQLAlchemy 1.4 / 2.0 support for aiohttp.

Library provide:

* AsyncSession as ``request['sa_main']`` or ``SAView.sa_main_session``
* AsyncEngine as ``request.app['sa_main']``

Install
-------
::
Expand Down Expand Up @@ -63,7 +68,8 @@ Multiple middlewares
app = web.Application(middlewares=[
sa_middleware(),
sa_middleware('sa_secondary')])
sa_middleware('sa_secondary'),
])
main_engine = create_async_engine('sqlite+aiosqlite:///')
secondary_engine = create_async_engine('sqlite+aiosqlite:///')
aiohttp_sqlalchemy.setup(app, [
Expand All @@ -76,7 +82,7 @@ Decorator approach
------------------
But you can use decorators instead of middlewares.

Decorated coroutine function
Decorating coroutine function
''''''''''''''''''''''''''''

.. code-block:: python
Expand All @@ -94,8 +100,8 @@ Decorated coroutine function
engine = create_async_engine('sqlite+aiosqlite:///')
aiohttp_sqlalchemy.setup(app, [sa_engine(engine)])
Decorated class based view
''''''''''''''''''''''''''
Decorating class based view methods
'''''''''''''''''''''''''''''''''''

.. code-block:: python
Expand All @@ -116,7 +122,7 @@ Decorated class based view
Hybrid approach
---------------
And you can combine the middleware approach and the decorator approach.
And you can combine middlewares and decorators.

.. code-block:: python
Expand Down

0 comments on commit 8e4d329

Please sign in to comment.