Mysql related functionality finished
This commit is contained in:
22
utils/db/db_execution.py
Normal file
22
utils/db/db_execution.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user