From f8a6049de24a1b92b6d1c3456570c47f464aaf21 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 31 May 2021 22:43:28 -0700 Subject: [PATCH] aurweb.db.session: Use autoflush=True for Sessions We'd like SQLAlchemy to automatically maintain flushes for us. Signed-off-by: Kevin Morris --- aurweb/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aurweb/db.py b/aurweb/db.py index bb58c0c8..ca5ce412 100644 --- a/aurweb/db.py +++ b/aurweb/db.py @@ -135,7 +135,7 @@ def get_engine(): # https://fastapi.tiangolo.com/tutorial/sql-databases/#note connect_args["check_same_thread"] = False engine = create_engine(get_sqlalchemy_url(), connect_args=connect_args) - Session = sessionmaker(autocommit=False, autoflush=False, bind=engine) + Session = sessionmaker(autocommit=False, autoflush=True, bind=engine) session = Session() return engine