MCPcopy Index your code
hub / github.com/fastapi/fastapi / delete_hero

Function delete_hero

docs_src/sql_databases/tutorial002_py310.py:96–102  ·  view source on GitHub ↗
(hero_id: int, session: Session = Depends(get_session))

Source from the content-addressed store, hash-verified

94
95@app.delete("/heroes/{hero_id}")
96def delete_hero(hero_id: int, session: Session = Depends(get_session)):
97 hero = session.get(Hero, hero_id)
98 if not hero:
99 raise HTTPException(status_code=404, detail="Hero not found")
100 session.delete(hero)
101 session.commit()
102 return {"ok": True}

Callers

nothing calls this directly

Calls 4

DependsClass · 0.90
HTTPExceptionClass · 0.90
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…