fastapi-sqlalchemy icon indicating copy to clipboard operation
fastapi-sqlalchemy copied to clipboard

Routing does not need to be connected database through dependency injection ?

Open Jieszs opened this issue 4 years ago • 1 comments

@router.get("/metaEvents/{event_id}") async def get_one( event_id: int, db: Session = Depends(deps.get_db), ):

Jieszs avatar Jun 25 '21 07:06 Jieszs

How to make sure the database session is always closed after the request. Even if there was an exception while processing the request.

Jieszs avatar Jun 25 '21 07:06 Jieszs