Provide forwards compatibility for the handle_error event.
See the “handle_error” event at http://docs.sqlalchemy.org/en/rel_0_9/core/events.html.
Bases: object
Encapsulate information about an error condition in progress.
This is for forwards compatibility with the ExceptionContext interface introduced in SQLAlchemy 0.9.7.
It also provides for the “engine” argument added in SQLAlchemy 1.0.0.
The exception that was returned by the previous handler in the exception chain, if any.
If present, this exception will be the one ultimately raised by SQLAlchemy unless a subsequent handler replaces it.
May be None.
The Connection in use during the exception.
This member is present, except in the case of a failure when first connecting.
The DBAPI cursor object.
May be None.
The Engine in use during the exception.
This member should always be present, even in the case of a failure when first connecting.
The ExecutionContext corresponding to the execution operation in progress.
This is present for statement execution operations, but not for operations such as transaction begin/end. It also is not present when the exception was raised before the ExecutionContext could be constructed.
Note that the ExceptionContext.statement and ExceptionContext.parameters members may represent a different value than that of the ExecutionContext, potentially in the case where a ConnectionEvents.before_cursor_execute() event or similar modified the statement/parameters to be sent.
May be None.
Represent whether the exception as occurred represents a “disconnect” condition.
This flag will always be True or False within the scope of the ConnectionEvents.handle_error() handler.
The exception object which was caught.
This member is always present.
Parameter collection that was emitted directly to the DBAPI.
May be None.
The sqlalchemy.exc.StatementError which wraps the original, and will be raised if exception handling is not circumvented by the event.
May be None, as not all exception types are wrapped by SQLAlchemy. For DBAPI-level exceptions that subclass the dbapi’s Error class, this field will always be present.
String SQL statement that was emitted directly to the DBAPI.
May be None.
Add a handle_error listener for the given Engine.
This listener uses the SQLAlchemy sqlalchemy.event.ConnectionEvents.handle_error() event.