The Python database API, or DBAPI, is a specification for database drivers which can be located at Pep-249. This API specifies a set of exception classes that accommodate the full range of failure modes of the database.
SQLAlchemy does not generate these exceptions directly. Instead, they are intercepted from the database driver and wrapped by the SQLAlchemy-provided exception DBAPIError
, however the messaging within the exception is generated by the driver, not SQLAlchemy.
InterfaceError
Exception raised for errors that are related to the database interface rather than the database itself.
This error is a DBAPI Error and originates from the database driver (DBAPI), not SQLAlchemy itself.
The InterfaceError
is sometimes raised by drivers in the context of the database connection being dropped, or not being able to connect to the database. For tips on how to deal with this, see the section Dealing with Disconnects.
DatabaseError
Exception raised for errors that are related to the database itself, and not the interface or data being passed.
This error is a DBAPI Error and originates from the database driver (DBAPI), not SQLAlchemy itself.
DataError
Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.
This error is a DBAPI Error and originates from the database driver (DBAPI), not SQLAlchemy itself.
OperationalError
Exception raised for errors that are related to the database’s operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
This error is a DBAPI Error and originates from the database driver (DBAPI), not SQLAlchemy itself.
The OperationalError
is the most common (but not the only) error class used by drivers in the context of the database connection being dropped, or not being able to connect to the database. For tips on how to deal with this, see the section Dealing with Disconnects.
IntegrityError
Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.
This error is a DBAPI Error and originates from the database driver (DBAPI), not SQLAlchemy itself.
7pm.pub(2016/10/28 11:41:03)
不错的网站主题,看着相当舒服