MCPcopy
hub / github.com/fastapi/sqlmodel / create_heroes

Function create_heroes

docs_src/tutorial/code_structure/tutorial002_py310/app.py:8–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def create_heroes():
9 with Session(engine) as session:
10 team_z_force = Team(name="Z-Force", headquarters="Sister Margaret's Bar")
11
12 hero_deadpond = Hero(
13 name="Deadpond", secret_name="Dive Wilson", team=team_z_force
14 )
15 session.add(hero_deadpond)
16 session.commit()
17
18 session.refresh(hero_deadpond)
19
20 print("Created hero:", hero_deadpond)
21 print("Hero's team:", hero_deadpond.team)
22
23
24def main():

Callers 1

mainFunction · 0.70

Calls 3

SessionClass · 0.90
TeamClass · 0.70
HeroClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…