Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ri-gilfanov committed Jun 15, 2021
2 parents ce1bd0f + 358280d commit 60c4b7d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 6 additions & 2 deletions aiohttp_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
TSABinding = Tuple[TSessionFactory, str, bool]


__version__ = '0.12.0'
__version__ = '0.13.0'

__all__ = ['DuplicateAppKeyError', 'DuplicateRequestKeyError',
'SAAbstractView', 'SABaseView', 'sa_bind', 'sa_decorator',
Expand All @@ -36,7 +36,11 @@ def sa_bind(bind_to: 'TBindTo', key: str = DEFAULT_KEY, *,
bind_to = cast(AsyncEngine, create_async_engine(bind_to))

if isinstance(bind_to, AsyncEngine):
bind_to = cast('TSessionFactory', sessionmaker(bind_to, AsyncSession))
bind_to = cast('TSessionFactory', sessionmaker(
bind=bind_to,
class_=AsyncSession,
expire_on_commit=False,
))

if isinstance(bind_to, Engine):
msg = 'Synchronous engine is unsupported argument for `sa_bind()`.'
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Ruslan Ilyasovich Gilfanov'

# The full version, including alpha/beta/rc tags
release = '0.12.0'
release = '0.13.0'


# -- General configuration ---------------------------------------------------
Expand Down
15 changes: 11 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ Binding multiple session factories
second_engine = create_async_engine('mysql+aiomysql://user:password@host/database')
third_engine = create_async_engine('sqlite+aiosqlite:///')
MainSession = orm.sessionmaker(main_engine, AsyncSession)
SecondSession = orm.sessionmaker(second_engine, AsyncSession)
ThirdSession = orm.sessionmaker(third_engine, AsyncSession)
MainSession = orm.sessionmaker(main_engine, AsyncSession, expire_on_commit=False)
SecondSession = orm.sessionmaker(second_engine, AsyncSession, expire_on_commit=False)
ThirdSession = orm.sessionmaker(third_engine, AsyncSession, expire_on_commit=False)
aiohttp_sqlalchemy.setup(app, [
sa_bind(MainSession),
Expand Down Expand Up @@ -194,7 +194,7 @@ Nested apps
app = web.Application()
engine = create_async_engine('sqlite+aiosqlite:///')
Session = orm.sessionmaker(engine, AsyncSession)
Session = orm.sessionmaker(engine, AsyncSession, expire_on_commit=False)
aiohttp_sqlalchemy.setup(app, [sa_engine(Session)])
subapp = web.Application()
Expand All @@ -205,6 +205,13 @@ Nested apps
Change log
----------
Version 0.13
^^^^^^^^^^^^
Changed
"""""
* Argument ``expire_on_commit`` of ``sessionmaker`` set to ``False``
by default.

Version 0.12
^^^^^^^^^^^^
Added
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aiohttp-sqlalchemy"
version = "0.12.0"
version = "0.13.0"
description = "SQLAlchemy 1.4 / 2.0 support for aiohttp."
authors = [
"Ruslan Ilyasovich Gilfanov <ri.gilfanov@yandex.ru>",
Expand Down

0 comments on commit 60c4b7d

Please sign in to comment.