14 lines
371 B
Python
14 lines
371 B
Python
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from backend.app.core.config import settings
|
|
|
|
from sqlmodel import create_engine, SQLModel
|
|
|
|
engine = create_engine(settings.SQLALCHEMY_DATABASE_URI, pool_pre_ping=True)
|
|
def create_db_and_tables():
|
|
SQLModel.metadata.create_all(engine)
|
|
|
|
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|