PIbd-42_SSPR/db/repositories/experiment_data_repos.py

15 lines
482 B
Python

from typing import Sequence
from sqlalchemy.future import select
from db.models.experiment_data_model import ExperimentData
from db.postgres_db_connection import async_session_postgres
async def get_exp_data_by_file_id(file_id: str) -> Sequence[ExperimentData]:
async with async_session_postgres() as session:
result = await session.execute(
select(ExperimentData).where(ExperimentData.file_id == file_id)
)
return result.scalars().all()