fix(fastapi): removes check same thead for psql and mysql
This commit is contained in:
parent
6d5d77d874
commit
037defa6e5
1 changed files with 5 additions and 1 deletions
|
|
@ -7,7 +7,11 @@ from sqlmodel import Session
|
|||
sql_url = os.getenv("SQL_URL") or "sqlite:///" + os.path.join(
|
||||
os.getenv("APP_DATA_DIRECTORY"), "fastapi.db"
|
||||
)
|
||||
sql_engine = create_engine(sql_url)
|
||||
connect_args = {}
|
||||
if "sqlite" in sql_url:
|
||||
connect_args["check_same_thread"] = False
|
||||
|
||||
sql_engine = create_engine(sql_url, connect_args=connect_args)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue