Coverage for app\db.py: 67%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-25 15:02 -0300
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-25 15:02 -0300
1"""Database module config."""
2from sqlmodel import Session, SQLModel, create_engine
4from app.config import get_settings
6settings = get_settings()
8engine = create_engine(settings.database_url, echo=True)
11def init_db():
12 """Initialize database."""
13 SQLModel.metadata.create_all(engine)
16def get_session():
17 """Session database."""
18 with Session(engine) as session:
19 yield session