exceptions

exception advanced_alchemy.exceptions.AdvancedAlchemyError[source]

Bases: Exception

Base exception class from which all Advanced Alchemy exceptions inherit.

__init__(*args, detail='')[source]

Initialize AdvancedAlchemyException.

Parameters:
  • *args (Any) – args are converted to str before passing to Exception

  • detail (str) – detail of the exception.

exception advanced_alchemy.exceptions.ConflictError[source]

Bases: RepositoryError

Data integrity error.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

Note

This class is deprecated in favor of advanced_alchemy.exceptions.IntegrityError.

__init__(*args, detail='')[source]

Initialize AdvancedAlchemyException.

Parameters:
  • *args (Any) – args are converted to str before passing to Exception

  • detail (str) – detail of the exception.

exception advanced_alchemy.exceptions.DuplicateKeyError[source]

Bases: IntegrityError

Duplicate key error.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

class advanced_alchemy.exceptions.ErrorMessages[source]

Bases: TypedDict

exception advanced_alchemy.exceptions.ForeignKeyError[source]

Bases: IntegrityError

Foreign key error.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.ImproperConfigurationError[source]

Bases: AdvancedAlchemyError

Improper Configuration error.

This exception is raised when there is an issue with the configuration of a module.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.IntegrityError[source]

Bases: RepositoryError

Data integrity error.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.MissingDependencyError[source]

Bases: AdvancedAlchemyError, ImportError

Missing optional dependency.

This exception is raised when a module depends on a dependency that has not been installed.

Parameters:
  • package (str) – Name of the missing package.

  • install_package (Optional[str]) – Optional alternative package name to install.

__init__(package, install_package=None)[source]

Initialize AdvancedAlchemyException.

Parameters:
  • *args – args are converted to str before passing to Exception

  • detail – detail of the exception.

exception advanced_alchemy.exceptions.MultipleResultsFoundError[source]

Bases: RepositoryError

Multiple results found error.

This exception is raised when a single result was expected but multiple were found.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.NotFoundError[source]

Bases: RepositoryError

Not found error.

This exception is raised when a requested resource is not found.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.RepositoryError[source]

Bases: AdvancedAlchemyError

Base repository exception type.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

exception advanced_alchemy.exceptions.SerializationError[source]

Bases: AdvancedAlchemyError

Encoding or decoding error.

This exception is raised when serialization or deserialization of an object fails.

Parameters:
  • *args (Any) – Variable length argument list passed to parent class.

  • detail (str) – Detailed error message.

advanced_alchemy.exceptions.wrap_sqlalchemy_exception(error_messages=None, dialect_name=None, wrap_exceptions=True)[source]

Do something within context to raise a RepositoryError chained from an original 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 a RepositoryError. When set to False, the original exception will be raised.

  • try (>>>)

  • wrap_sqlalchemy_exception() (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception. with)

  • SQLAlchemyError (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception. raise)

  • exc (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception.except RepositoryError as)

  • print( (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception.)

  • {type (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception. f"caught repository exception from)

  • ) (... _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception.)

  • 'sqlalchemy.exc.SQLAlchemyError'> (caught _sphinx_paramlinks_advanced_alchemy.exceptions.wrap_sqlalchemy_exception.repository exception from <class)

Return type:

Generator[None, None, None]