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

Function delete_hero

docs_src/sql_databases/tutorial002_an_py310.py:97–103  ·  view source on GitHub ↗
(hero_id: int, session: SessionDep)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

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…