22 lines
611 B
Python
22 lines
611 B
Python
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from sqlalchemy import select
|
|
|
|
from models.execution.model_execution import ExecutionModel
|
|
|
|
|
|
class ExecutionQueryAsync:
|
|
|
|
def __init__(self, db: AsyncSession):
|
|
self.db = db
|
|
|
|
async def get_execution(self):
|
|
result = await self.db.execute(select(ExecutionModel))
|
|
rows = result.scalars().all()
|
|
return rows
|
|
|
|
async def get_execution_by_id(self, id):
|
|
stmt = select(ExecutionModel).where(ExecutionModel.id == id)
|
|
result = await self.db.execute(stmt)
|
|
rows = result.scalars().all()
|
|
return rows
|
|
|