minos.aggregate.snapshots.repositories.database.factories

Classes

SnapshotDatabaseOperationFactory

Snapshot Database Operation Factory class.

class SnapshotDatabaseOperationFactory[source]

Bases: DatabaseOperationFactory, ABC

Snapshot Database Operation Factory class.

abstract build_create()[source]

Build the database operation to create the snapshot table.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_delete(transaction_uuids)[source]

Build the database operation to delete rows by transaction identifiers.

Parameters

transaction_uuids (Iterable[UUID]) – The transaction identifiers.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_submit(uuid, name, version, schema, data, created_at, updated_at, transaction_uuid)[source]

Build the insert database operation.

Parameters
  • uuid (UUID) – The identifier of the entity.

  • name (str) – The name of the entity.

  • version (int) – The version of the entity.

  • schema (bytes) – The schema of the entity.

  • data (dict[str, Any]) – The data of the entity.

  • created_at (datetime) – The creation datetime.

  • updated_at (datetime) – The last update datetime.

  • transaction_uuid (UUID) – The transaction identifier.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_query(name, condition, ordering, limit, transaction_uuids, exclude_deleted)[source]

Build the query database operation.

Parameters
  • name (str) – Class name of the RootEntity.

  • condition (_Condition) – The condition that must be satisfied by the RootEntity instances.

  • ordering (Optional[_Ordering]) – Optional argument to return the instance with specific ordering strategy. The default behaviour is to retrieve them without any order pattern.

  • limit (Optional[int]) – Optional argument to return only a subset of instances. The default behaviour is to return all the instances that meet the given condition.

  • transaction_uuids (tuple[uuid.UUID, ...]) – The transaction within the operation is performed. If not any value is provided, then the transaction is extracted from the context var. If not any transaction is being scoped then the query is performed to the global snapshot.

  • exclude_deleted (bool) – If True, deleted RootEntity entries are included, otherwise deleted RootEntity entries are filtered.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_submit_offset(value)[source]

Build the database operation to store the offset.

Parameters

value (int) – The value to be stored as the new offset.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation

abstract build_query_offset()[source]

Build the database operation to get the current offset.

Returns

A DatabaseOperation instance.

Return type

DatabaseOperation