code-review-fix task 14.2: remove dead get_db_session function from db.py
This commit is contained in:
parent
c9c63aafa3
commit
8d9a86efb4
1 changed files with 0 additions and 15 deletions
|
|
@ -87,18 +87,3 @@ def get_db() -> Generator[Session, None, None]:
|
||||||
yield db
|
yield db
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
def get_db_session() -> Session:
|
|
||||||
"""
|
|
||||||
Get a database session (for dependency injection).
|
|
||||||
|
|
||||||
Usage with FastAPI:
|
|
||||||
@app.get("/")
|
|
||||||
def endpoint(db: Session = Depends(get_db_session)):
|
|
||||||
# Use db here
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Database session (caller must close it)
|
|
||||||
"""
|
|
||||||
return SessionLocal()
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue