2024-10-27 23:29:52 +04:00
|
|
|
from typing import Sequence
|
|
|
|
|
2024-10-25 02:02:31 +04:00
|
|
|
from sqlalchemy.future import select
|
2024-10-27 23:29:52 +04:00
|
|
|
|
2024-10-14 21:18:07 +04:00
|
|
|
from db.models.experiment_parameters_model import ExperimentParameters
|
2024-10-28 13:30:02 +04:00
|
|
|
from db.postgres_db_connection import async_session_postgres
|
2024-10-14 21:18:07 +04:00
|
|
|
|
2024-10-27 23:29:52 +04:00
|
|
|
|
2024-10-28 13:30:02 +04:00
|
|
|
async def get_exp_parameters_by_category(category_id: int) -> Sequence[ExperimentParameters]:
|
|
|
|
async with async_session_postgres() as session:
|
|
|
|
result = await session.execute(
|
2024-10-27 23:29:52 +04:00
|
|
|
select(ExperimentParameters).where(ExperimentParameters.experiment_category_id == category_id)
|
|
|
|
)
|
|
|
|
return result.scalars().all()
|
|
|
|
|
2024-10-28 13:30:02 +04:00
|
|
|
async def get_exp_parameters_by_exp_hash(exp_hash: str) -> Sequence[ExperimentParameters]:
|
|
|
|
async with async_session_postgres() as session:
|
|
|
|
result = await session.execute(
|
|
|
|
select(ExperimentParameters).where(ExperimentParameters.experiment_hash == exp_hash)
|
2024-10-22 16:46:39 +04:00
|
|
|
)
|
2024-10-28 13:30:02 +04:00
|
|
|
return result.scalars().all()
|