class DontWrapMixin(object):
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!")