Spaces:
Sleeping
Sleeping
taboola commited on
Commit ·
397604e
1
Parent(s): b76ca30
fix delete_parsed_data to accept data_type argument
Browse files
chatkit/backend/app/database.py
CHANGED
|
@@ -252,9 +252,14 @@ async def get_parsed_data(session_id: int) -> list[dict]:
|
|
| 252 |
return [_row(p) for p in res.scalars().all()]
|
| 253 |
|
| 254 |
|
| 255 |
-
async def delete_parsed_data(session_id: int):
|
| 256 |
async with get_sessionmaker()() as db:
|
| 257 |
-
await db.execute(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
await db.commit()
|
| 259 |
|
| 260 |
|
|
|
|
| 252 |
return [_row(p) for p in res.scalars().all()]
|
| 253 |
|
| 254 |
|
| 255 |
+
async def delete_parsed_data(session_id: int, data_type: str):
|
| 256 |
async with get_sessionmaker()() as db:
|
| 257 |
+
await db.execute(
|
| 258 |
+
delete(ParsedData).where(
|
| 259 |
+
ParsedData.quiz_id == session_id,
|
| 260 |
+
ParsedData.data_type == data_type,
|
| 261 |
+
)
|
| 262 |
+
)
|
| 263 |
await db.commit()
|
| 264 |
|
| 265 |
|