from sqlmodel import Session

from .database import create_db_and_tables, engine
from .hero_model import Hero
from .team_model import Team


def create_heroes():
    with Session(engine) as session:
        team_z_force = Team(name="Z-Force", headquarters="<NAME>")

        hero_deadpond = Hero(
            name="Deadpond", secret_name="<NAME>", team=team_z_force, experience_points=1
        )
        session.add(hero_deadpond)
        session.commit()

        session.refresh(hero_deadpond)

        print("Created hero:", hero_deadpond)
        print("Hero's team:", hero_deadpond.team)


def main():
    create_db_and_tables()
    create_heroes()


if __name__ == "__main__":
    main()

sqlmodel.Session
[((171, 186), 'sqlmodel.Session', 'Session', (['engine'], {}), '(engine)\n', (178, 186), False, 'from sqlmodel import Session\n')]