diff options
author | Federico Caselli <cfederico87@gmail.com> | 2020-12-03 23:53:47 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2020-12-08 15:41:23 +0100 |
commit | 76d90152302461637cfecb6c0cac65a50975c570 (patch) | |
tree | 15a1df7c7b3234bcc1d6ac1d81d44e1d76f21d55 /lib/sqlalchemy/exc.py | |
parent | 92a12bcc5112ab27357a82e72af98b459af184a7 (diff) | |
download | sqlalchemy-76d90152302461637cfecb6c0cac65a50975c570.tar.gz |
Detect non compatible execution in async mode
The SQLAlchemy async mode now detects and raises an informative
error when an non asyncio compatible :term:`DBAPI` is used.
Using a standard ``DBAPI`` with async SQLAlchemy will cause
it to block like any sync call, interrupting the executing asyncio
loop.
Change-Id: I9aed87dc1b0df53e8cb2109495237038aa2cb2d4
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r-- | lib/sqlalchemy/exc.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index 7ba2e369b..63c56c34d 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -285,6 +285,15 @@ class NoReferenceError(InvalidRequestError): """Raised by ``ForeignKey`` to indicate a reference cannot be resolved.""" +class AwaitRequired(InvalidRequestError): + """Error raised by the async greenlet spawn if no async operation + was awaited when it required one + + """ + + code = "xd1r" + + class NoReferencedTableError(NoReferenceError): """Raised by ``ForeignKey`` when the referred ``Table`` cannot be located. @@ -355,10 +364,6 @@ class DontWrapMixin(object): """ -# Moved to orm.exc; compatibility definition installed by orm import until 0.6 -UnmappedColumnError = None - - class StatementError(SQLAlchemyError): """An error occurred during execution of a SQL statement. |