]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
pep-484: asyncio
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 10 Apr 2022 19:42:35 +0000 (15:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 12 Apr 2022 02:11:07 +0000 (22:11 -0400)
commita45e2284dad17fbbba3bea9d5e5304aab21c8c94
treeac31614f2d53059570e2edffe731baf384baea23
parentaa9cd878e8249a4a758c7f968e929e92fede42a5
pep-484: asyncio

in this patch the asyncio/events.py module, which
existed only to raise errors when trying to attach event
listeners, is removed, as we were already coding an asyncio-specific
workaround in upstream Pool / Session to raise this error,
just moved the error out to the target and did the same thing
for Engine.

We also add an async_sessionmaker class.  The initial rationale
here is because sessionmaker() is hardcoded to Session subclasses,
and there's not a way to get the use case of
sessionmaker(class_=AsyncSession) to type correctly without changing
the sessionmaker() symbol itself to be a function and not a class,
which gets too complicated for what this is. Additionally,
_SessionClassMethods has only three methods on it, one of which
is not usable with asyncio (close_all()), the others
not generally used from the session class.

Change-Id: I064a5fa5d91cc8d5bbe9597437536e37b4e801fe
29 files changed:
doc/build/orm/extensions/asyncio.rst
examples/asyncio/async_orm.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/events.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/event/base.py
lib/sqlalchemy/ext/asyncio/__init__.py
lib/sqlalchemy/ext/asyncio/base.py
lib/sqlalchemy/ext/asyncio/engine.py
lib/sqlalchemy/ext/asyncio/events.py [deleted file]
lib/sqlalchemy/ext/asyncio/result.py
lib/sqlalchemy/ext/asyncio/scoping.py
lib/sqlalchemy/ext/asyncio/session.py
lib/sqlalchemy/orm/base.py
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/instrumentation.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/scoping.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/state.py
lib/sqlalchemy/pool/events.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/util/_concurrency_py3k.py
pyproject.toml
test/ext/asyncio/test_engine_py3k.py
test/ext/asyncio/test_session_py3k.py
test/ext/mypy/plain_files/async_sessionmaker.py [new file with mode: 0644]
test/ext/mypy/plain_files/session.py