From a234f95ace017b0297ef63e13e5d8acfb355bbe1 Mon Sep 17 00:00:00 2001 From: DmitryGantimurov Date: Tue, 18 Jul 2023 23:47:01 +0300 Subject: [PATCH] pass new parameters to sessionmaker --- back/db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/back/db.py b/back/db.py index 6c1b951..cab4b6f 100644 --- a/back/db.py +++ b/back/db.py @@ -11,7 +11,11 @@ from fastapi import Depends 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() Base = declarative_base() \ No newline at end of file