|
|
|
@ -6,6 +6,7 @@ from uuid import UUID
|
|
|
|
|
|
|
|
|
|
|
|
from sqlalchemy import Delete, Select, func
|
|
|
|
from sqlalchemy import Delete, Select, func
|
|
|
|
from sqlalchemy.inspection import inspect as sa_inspect
|
|
|
|
from sqlalchemy.inspection import inspect as sa_inspect
|
|
|
|
|
|
|
|
from sqlalchemy.orm import selectinload
|
|
|
|
|
|
|
|
|
|
|
|
from src.database.core import DbSession
|
|
|
|
from src.database.core import DbSession
|
|
|
|
from src.database.service import search_filter_sort_paginate
|
|
|
|
from src.database.service import search_filter_sort_paginate
|
|
|
|
@ -39,7 +40,14 @@ PLANT_COPY_COLUMNS = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get(*, db_session: DbSession, simulation_id: str) -> Optional[Simulation]:
|
|
|
|
async def get(*, db_session: DbSession, simulation_id: str) -> Optional[Simulation]:
|
|
|
|
query = Select(Simulation).where(Simulation.id == simulation_id)
|
|
|
|
query = (
|
|
|
|
|
|
|
|
Select(Simulation)
|
|
|
|
|
|
|
|
.options(
|
|
|
|
|
|
|
|
selectinload(Simulation.masterdata_entries),
|
|
|
|
|
|
|
|
selectinload(Simulation.plant_transactions),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.where(Simulation.id == simulation_id)
|
|
|
|
|
|
|
|
)
|
|
|
|
result = await db_session.execute(query)
|
|
|
|
result = await db_session.execute(query)
|
|
|
|
return result.scalars().one_or_none()
|
|
|
|
return result.scalars().one_or_none()
|
|
|
|
|
|
|
|
|
|
|
|
|