FastAPI - Database Integration
Given this FastAPI route code snippet, what will be the output if the database session is correctly managed?
from fastapi import FastAPI, Depends
from sqlalchemy.orm import Session
app = FastAPI()
def get_db():
db = Session()
try:
yield db
finally:
db.close()
@app.get('/items')
def read_items(db: Session = Depends(get_db)):
items = db.query(Item).all()
return items