pass new parameters to sessionmaker

This commit is contained in:
DmitryGantimurov 2023-07-18 23:47:01 +03:00
parent 1dd37a72b4
commit 626170964f

View File

@ -11,7 +11,11 @@ from fastapi import Depends
SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
SessionLocal = sessionmaker(class_='Session', bind=Engine(sqlite:///./sql_app.db), autoflush=True, autocommit=False, expire_on_commit=False) engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(bind=engine, autoflush=True, autocommit=False, expire_on_commit=False)
database = SessionLocal() database = SessionLocal()
Base = declarative_base() Base = declarative_base()