common.application_layer.orm_repositories package

Submodules

common.application_layer.orm_repositories.initialize_persistence module

common.application_layer.orm_repositories.orm_model module

common.application_layer.orm_repositories.orm_repository module

common.application_layer.orm_repositories.orm_types module

Module contents

common.application_layer.orm_repositories.add_entity(session: <MagicMock id = '140601150351616'>, entity: object, integrity_error_msgs: dict[type, str] | None=None) → None

Method used by every ORM SubRepository to safely try adding an object to the database, rolling back if there is an exception during the transaction

Parameters:
  • session – The ORM Session

  • entity – Entity to add to the database

  • integrity_error_msgs – Dictionary that maps IntegrityError subclasses to the error messages to display if they are raised

Raises:

ValueError – When an IntegrityError is raised by SQLAlchemy

common.application_layer.orm_repositories.get_object_by_id(session: <MagicMock id='140601150351616'>, entity_id: ~common.application_layer.orm_repositories.U, entity_type: ~typing.Type[~common.application_layer.orm_repositories.T], id_attr: ~common.application_layer.orm_repositories.U) → T

Method used by every ORM SubRepository to retrieve a stored entity of a given type with a given ID

Parameters:
  • session – An ORM session

  • entity_id – The ID of the entity to retrieve

  • entity_type – Type of entity to retrieve

  • id_attr – Attribute of entity_type representing its ID; there should be at most 1 entity of entity_type with any given value of id_attr

Raises:

ValueError – When no entity of the given type and ID is found in the database

common.application_layer.orm_repositories.list_entities(session: <MagicMock id='140601150351616'>, entity_type: ~typing.Type[~common.application_layer.orm_repositories.T], *order_by_attributes) → list[T]

Method used by every ORM SubRepository to get a list of stored entities given a domainmodel class

Parameters:
  • session – the orm session

  • entity_type – Type of entity to list

  • order_by_attributes – Optional list of attributes to order by

Returns:

list of domainmodel objects