exceptions¶
- exception advanced_alchemy.exceptions.AdvancedAlchemyError[source]¶
Bases:
ExceptionBase exception class from which all Advanced Alchemy exceptions inherit.
- exception advanced_alchemy.exceptions.DuplicateKeyError[source]¶
Bases:
IntegrityErrorDuplicate key error.
- exception advanced_alchemy.exceptions.ForeignKeyError[source]¶
Bases:
IntegrityErrorForeign key error.
- exception advanced_alchemy.exceptions.ImproperConfigurationError[source]¶
Bases:
AdvancedAlchemyErrorImproper Configuration error.
This exception is raised when there is an issue with the configuration of a module.
- exception advanced_alchemy.exceptions.IntegrityError[source]¶
Bases:
RepositoryErrorData integrity error.
- exception advanced_alchemy.exceptions.MissingDependencyError[source]¶
Bases:
AdvancedAlchemyError,ImportErrorMissing optional dependency.
This exception is raised when a module depends on a dependency that has not been installed.
- Parameters:
- exception advanced_alchemy.exceptions.MultipleResultsFoundError[source]¶
Bases:
RepositoryErrorMultiple results found error.
This exception is raised when a single result was expected but multiple were found.
- exception advanced_alchemy.exceptions.NotFoundError[source]¶
Bases:
RepositoryErrorNot found error.
This exception is raised when a requested resource is not found.
- exception advanced_alchemy.exceptions.RepositoryError[source]¶
Bases:
AdvancedAlchemyErrorBase repository exception type.
- exception advanced_alchemy.exceptions.SerializationError[source]¶
Bases:
AdvancedAlchemyErrorEncoding or decoding error.
This exception is raised when serialization or deserialization of an object fails.
- advanced_alchemy.exceptions.wrap_sqlalchemy_exception(error_messages=None, dialect_name=None, wrap_exceptions=True)[source]¶
Do something within context to raise a
RepositoryErrorchained from an originalSQLAlchemyError.>>> try: ... with wrap_sqlalchemy_exception(): ... raise SQLAlchemyError("Original Exception") ... except RepositoryError as exc: ... print( ... f"caught repository exception from {type(exc.__context__)}" ... ) caught repository exception from <class 'sqlalchemy.exc.SQLAlchemyError'>
- Parameters:
error_messages¶ (
Optional[ErrorMessages]) – Error messages to use for the exception.dialect_name¶ (
Optional[str]) – The name of the dialect to use for the exception.wrap_exceptions¶ (
bool) – Wrap SQLAlchemy exceptions in aRepositoryError. When set toFalse, the original exception will be raised.error_messages (ErrorMessages | None)
dialect_name (str | None)
wrap_exceptions (bool)
- Raises:
NotFoundError – Raised when no rows matched the specified data.
MultipleResultsFound – Raised when multiple rows matched the specified data.
IntegrityError – Raised when an integrity error occurs.
InvalidRequestError – Raised when an invalid request was made to SQLAlchemy.
RepositoryError – Raised for other SQLAlchemy errors.
AttributeError – Raised when an attribute error occurs during processing.
SQLAlchemyError – Raised for general SQLAlchemy errors.
StatementError – Raised when there is an issue processing the statement.
MultipleResultsFoundError – Raised when multiple rows matched the specified data.
- Return type: