Exceptions used with SQLAlchemy.
The base exception class is SQLAlchemyError. Exceptions which are raised as a result of DBAPI exceptions are all subclasses of DBAPIError.
Raised when more than one foreign key matching can be located between two selectables during a join.
Raised when an invalid or conflicting function argument is supplied.
This error generally corresponds to construction time state errors.
Raised by topological sorts when a circular dependency is detected.
There are two scenarios where this error occurs:
Raised when an error occurs during SQL compilation
Raised when the execution of a database operation fails.
Wraps exceptions raised by the DB-API underlying the database operation. Driver-specific implementations of the standard DB-API exception types are wrapped by matching sub-types of SQLAlchemy’s DBAPIError when possible. DB-API’s Error type maps to DBAPIError in SQLAlchemy, otherwise the names are identical. Note that there is no guarantee that different DB-API implementations will raise the same exception type for any given error condition.
DBAPIError features statement and params attributes which supply context regarding the specifics of the statement which had an issue, for the typical case when the error was raised within the context of emitting a SQL statement.
The wrapped exception object is available in the orig attribute. Its type and properties are DB-API implementation specific.
Wraps a DB-API DataError.
Wraps a DB-API DatabaseError.
A disconnect is detected on a raw DB-API connection.
This error is raised and consumed internally by a connection pool. It can be raised by the PoolEvents.checkout() event so that the host pool forces a retry; the exception will be caught three times in a row before the pool gives up and raises InvalidRequestError regarding the connection attempt.
A mixin class which, when applied to a user-defined Exception class, will not be wrapped inside of StatementError if the error is emitted within the process of executing a statement.
E.g.:
from sqlalchemy.exc import DontWrapMixin
class MyCustomException(Exception, DontWrapMixin):
pass
class MySpecialType(TypeDecorator):
impl = String
def process_bind_param(self, value, dialect):
if value == 'invalid':
raise MyCustomException("invalid!")
Raised when a schema name is beyond the max character limit
Wraps a DB-API IntegrityError.
Wraps a DB-API InterfaceError.
Wraps a DB-API InternalError.
SQLAlchemy was asked to do something it can’t do.
This error generally corresponds to runtime state errors.
Raised when no foreign keys can be located between two selectables during a join.
A subject passed to sqlalchemy.inspection.inspect() produced no context for inspection.
Raised by ForeignKey to indicate a reference cannot be resolved.
Raised by ForeignKey when the referred Column cannot be located.
Raised by ForeignKey when the referred Table cannot be located.
A nonexistent column is requested from a RowProxy.
Raised when a dynamically-loaded module (usually a database dialect) of a particular name cannot be located.
Table does not exist or is not visible to a connection.
Wraps a DB-API NotSupportedError.
Wraps a DB-API OperationalError.
Wraps a DB-API ProgrammingError.
An operation was requested from a connection, cursor, or other object that’s in a closed state.
Issued once per usage of a deprecated API.
Issued once per usage of a deprecated API.
Issued at runtime.
Generic error class.
An error occurred during execution of a SQL statement.
StatementError wraps the exception raised during execution, and features statement and params attributes which supply context regarding the specifics of the statement which had an issue.
The wrapped exception object is available in the orig attribute.
The DBAPI exception object.
The parameter list being used when this exception occurred.
The string SQL statement being invoked when this exception occurred.
Raised when a connection pool times out on getting a connection.
SQL was attempted without a database connection to execute it on.
Raised when an operation is not supported by the given compiler.
New in version 0.8.3.