def get_result_set( *, db_session: Session = Depends(deps.db_session), result_set_crud: CRUDResultSet = Depends(deps.result_set_crud), result_set_id: str, ) -> Any: """Get a ResultSet by id""" try: return result_set_crud.get(db_session, result_set_id=result_set_id) except ResultSetNotFound as ex: raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=str(ex))
def get_result_set( *, db_session: Session = Depends(deps.db_session), result_set_crud: CRUDResultSet = Depends(deps.result_set_crud), result_set_id: str, result_format: schemas.ResultSetFormat = schemas.ResultSetFormat.json, ) -> Any: """Get a ResultSet by id""" try: result_set = result_set_crud.get(db_session, result_set_id=result_set_id) except ResultSetNotFound as ex: raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=str(ex)) from ex if result_format == schemas.ResultSetFormat.csv: return Response(content=result_set.to_api_schema().to_csv(), media_type="text/csv") return result_set