Source code for ska_db_oda.repository.execution

"""Repository classes for the execution schema (sb_instances, execution_blocks)."""

from psycopg import Connection
from ska_oso_pdm import OSOExecutionBlock, SBInstance

from ska_db_oda.postgres.mapping import ExecutionBlockMapping, SBInstanceMapping
from ska_db_oda.postgres.postgres_persistence import PostgresPersistence
from ska_db_oda.repository.base import AbstractRepository


[docs] class SBInstanceRepository(AbstractRepository[SBInstance, str]): """Abstraction over persistent storage of SBInstances.""" def __init__(self, conn: Connection): super().__init__(conn) self.postgres = PostgresPersistence(postgres_mapping=SBInstanceMapping(), connection=conn)
[docs] class ExecutionBlockRepository(AbstractRepository[OSOExecutionBlock, str]): """Abstraction over persistent storage of OSOExecutionBlocks.""" def __init__(self, conn: Connection): super().__init__(conn) self.postgres = PostgresPersistence( postgres_mapping=ExecutionBlockMapping(), connection=conn )