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

Function create_heroes

docs_src/tutorial/code_structure/tutorial001_py310/app.py:7–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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