RESTRepository module (ska_db_oda.infrastructure.rest.repository)

This module contains the bridge implementation for Repository class which connects to an ska-db-oda deployment over the network.

class ska_db_oda.infrastructure.rest.repository.RESTBridge(rest_mapping: RESTMapping, base_rest_uri: str)[source]

Implementation of the Repository bridge which connects to the ODA API.

create(entity: T) T[source]

Adds the entity to a pending transaction, ready to be committed as part of the UoW

Note unlike other implementations, this method does not update the metadata, as this is done inside the ODA service after the API is called

query(qry_params: QueryParams) List[U][source]

Queries the ODA API with the parameters

See query() docstring for details

read(entity_id: U) T[source]

Gets the latest version of the entity with the given entity_id.

As this method will always be accessed in the context of a UnitOfWork, the pending transactions also need to be checked. (Similar to with a database implementation where an entity that was added to a transaction but not committed would still be accessible inside the transaction.)

update(entity: T) T[source]

Adds the entity to a pending transaction, ready to be committed as part of the UoW.

As the update method edits in the existing entity, if an entity with the same ID is passed twice to this method, it will overwrite the previous version in the pending transactions.