DB related custom exceptions.
Custom exceptions intended to determine the causes of specific database errors. This module provides more generic exceptions than the database-specific driver libraries, and so users of oslo.db can catch these no matter which database the application is using. Most of the exceptions are wrappers. Wrapper exceptions take an original exception as positional argument and keep it for purposes of deeper debug.
Example:
try:
statement(arg)
except sqlalchemy.exc.OperationalError as e:
raise DBDuplicateEntry(e)
This is useful to determine more specific error cases further at execution, when you need to add some extra information to an error message. Wrapper exceptions takes care about original error message displaying to not to loose low level cause of an error. All the database api exceptions wrapped into the specific exceptions provided belove.
Please use only database related custom exceptions with database manipulations with try/except statement. This is required for consistent handling of database errors.
Bases: exceptions.Exception
Error raised when a particular database backend is not available
within a test suite.
Bases: exceptions.Exception
Error raised when the enginefacade cannot start up correctly.
Bases: exceptions.Exception
Error raised when no column or an invalid column is found.
Bases: exceptions.AttributeError
Error raised when requesting a not-setup enginefacade attribute.
This applies to the session and connection attributes of a user-defined context and/or RequestContext object, when they are accessed within the scope of an enginefacade decorator or context manager, but the context has not requested that attribute (e.g. like “with enginefacade.connection.using(context)” and “context.session” is requested).
Bases: oslo_db.exception.DBError
Wrapped connection specific exception.
Raised when database connection is failed.
Bases: oslo_db.exception.DBError
Check constraint fails for column error.
Raised when made an attempt to write to a column a value that does not satisfy a CHECK constraint.
Parameters: |
|
---|
Bases: oslo_db.exception.DBError
Raised for errors that are due to problems with the processed data.
E.g. division by zero, numeric value out of range, incorrect data type, etc
Bases: oslo_db.exception.DBError
Database dead lock error.
Deadlock is a situation that occurs when two or more different database sessions have some data locked, and each database session requests a lock on the data that another, different, session has already locked.
Bases: oslo_db.exception.DBError
Duplicate entry at unique column error.
Raised when made an attempt to write to a unique column the same entry as existing one. :attr: columns available on an instance of the exception and could be used at error handling:
try:
instance_type_ref.save()
except DBDuplicateEntry as e:
if 'colname' in e.columns:
# Handle error.
Parameters: |
|
---|
Bases: oslo_utils.excutils.CausedByException
Base exception for all custom database exceptions.
Parameters: | inner_exception – an original exception which was wrapped with DBError or its subclasses. |
---|
Bases: exceptions.Exception
Database unicode error.
Raised when unicode parameter is passed to a database without encoding directive.
Bases: oslo_db.exception.DbMigrationError
Wrapped migration specific exception.
Raised when migrations couldn’t be completed successfully.
Bases: oslo_db.exception.DBError
Constraint does not exist.
Parameters: |
|
---|
Bases: oslo_db.exception.DBError
Table does not exist.
Parameters: | table (str) – table name |
---|
Bases: oslo_db.exception.DBError
Foreign key violation error.
Parameters: |
|
---|
Bases: oslo_db.exception.DBError
Wrapped migration specific exception.
Raised when migrations couldn’t be completed successfully.
Bases: exceptions.Exception
A sort key destined for database query usage is invalid.
Bases: exceptions.AttributeError
Error raised for enginefacade attribute access with no context.
This applies to the session and connection attributes of a user-defined context and/or RequestContext object, when they are accessed outside of the scope of an enginefacade decorator or context manager.
The exception is a subclass of AttributeError so that normal Python missing attribute behaviors are maintained, such as support for getattr(context, 'session', None).
Bases: exceptions.Warning
Warn that an argument or call that was passed is not supported.
This subclasses Warning so that it can be filtered as a distinct category.
Bases: exceptions.DeprecationWarning
Issued per usage of a deprecated API.
This subclasses DeprecationWarning so that it can be filtered as a distinct category.
Bases: exceptions.Exception
Error raised when DB operation needs to be retried.
That could be intentionally raised by the code without any real DB errors.