def find_by_id(id: int) -> StepDto: try: with sql_fetch(StepDao._FIND_BY_ID, [id], row_mapper=StepDao._map_full_row, size=1) as step_dto: return step_dto except FetchOneException: raise NoResultException(f"No Step Found with id: {id}") from None
def find_by_id(id: int) -> RunDto: try: with sql_fetch(RunDao._FIND_BY_ID, [id], row_mapper=RunDao._map_full_row, size=1) as run_dto: return run_dto except FetchOneException: raise NoResultException(f"No Run Found with id: {id}") from None
def find_by_id(id: int) -> CommandDto: try: with sql_fetch(CommandDao._FIND_BY_ID, [id], row_mapper=CommandDao._map_full_row, size=1) as command_dto: return command_dto except FetchOneException: raise NoResultException( f"No Command Found with id: {id}") from None
def find_by_run_id_and_number(run_id: int, number: int): try: with sql_fetch(StepDao._FIND_BY_RUN_ID_AND_NUMBER, [run_id, number], row_mapper=StepDao._map_full_row, size=1) as step_dto: return step_dto except FetchOneException: raise NoResultException( f"No Step Found with run_id: {run_id} and number: {number}")
def find_by_step_id_and_number(step_id: int, number: int) -> CommandDto: try: with sql_fetch(CommandDao._FIND_BY_STEP_ID_AND_NUMBER, [step_id, number], row_mapper=CommandDao._map_full_row, size=1) as command_dto: return command_dto except FetchOneException: raise NoResultException( f"No Command Found with step_id: {step_id} and number: {number}" ) from None
def find_all_by_step_id(step_id: int) -> List[CommandDto]: with sql_fetch(CommandDao._FIND_BY_STEP_ID, [step_id], row_mapper=CommandDao._map_full_row, size=0) as step_dtos: return step_dtos
def find_all_by_run_id(run_id: int) -> List[StepDto]: with sql_fetch(StepDao._FIND_BY_RUN_ID, [run_id], row_mapper=StepDao._map_full_row, size=0) as step_dtos: return step_dtos
def find_jobs() -> List[JobDto]: with sql_fetch(JobDao._FIND_ALL_JOBS, [], row_mapper=JobDao._map_full_row, size=0) as jobs: return jobs
def find_job_by_uuid(uuid: str) -> JobDto: try: with sql_fetch(JobDao._FIND_JOB_BY_UUID, [uuid], row_mapper=JobDao._map_full_row, size=1) as job_dto: return job_dto except FetchOneException: raise NoResultException(f"No Job Found with uuid: {uuid}") from None
def find_all_by_job_id(id: int) -> List[RunDto]: with sql_fetch(RunDao._FIND_ALL_BY_JOB_ID, [id], row_mapper=RunDao._map_full_row, size=0) as run_dtos: return run_dtos