Merge pull request #154 from grillazz/152-implement-acyncpg-coon-pool-poc

- fix
This commit is contained in:
Jakub Miazek 2024-05-11 16:37:02 +02:00 committed by GitHub
commit 253f775d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,7 +81,6 @@ async def find_stuff_pool(
try: try:
stmt = await Stuff.find(db_session, name, compile_sql=True) stmt = await Stuff.find(db_session, name, compile_sql=True)
result = await request.app.postgres_pool.fetchrow(str(stmt)) result = await request.app.postgres_pool.fetchrow(str(stmt))
result = dict(result)
except SQLAlchemyError as ex: except SQLAlchemyError as ex:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex) status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex)
@ -91,7 +90,7 @@ async def find_stuff_pool(
status_code=status.HTTP_404_NOT_FOUND, status_code=status.HTTP_404_NOT_FOUND,
detail=f"Stuff with name {name} not found.", detail=f"Stuff with name {name} not found.",
) )
return result return dict(result)
@router.delete("/{name}") @router.delete("/{name}")