from create_db import Student
from sqlmodel import Session, create_engine, select

sqlite_url = "sqlite:///school.db"
engine = create_engine(sqlite_url, echo=True)

# Read database
with Session(engine) as session:
    statement = select(Student)
    results = session.exec(statement)
    for student in results:
        print(student)
        print("-" * 100)

# # Read one row
# with Session(engine) as session:
#     statement = select(Student).where(Student.first_name=="Misal")
#     results = session.exec(statement)
#     for student in results:
#         print(student)

sqlmodel.select sqlmodel.Session sqlmodel.create_engine
[((127, 163), 'sqlmodel.create_engine', 'create_engine', (['sqlite_url'], {'echo': '(True)'}), '(sqlite_url, echo=True)\n', (140, 163), False, 'from sqlmodel import Session, create_engine, select\n'), ((186, 201), 'sqlmodel.Session', 'Session', (['engine'], {}), '(engine)\n', (193, 201), False, 'from sqlmodel import Session, create_engine, select\n'), ((230, 245), 'sqlmodel.select', 'select', (['Student'], {}), '(Student)\n', (236, 245), False, 'from sqlmodel import Session, create_engine, select\n')]