Skip to content

Commit e870f5c

Browse files
authored
Merge pull request #43 from bugout-dev/fix-db-autoflush
Sessionmaker flush false
2 parents fdaef19 + d152bac commit e870f5c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

brood/db.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def create_brood_engine(url: Optional[str], pool_size: int, statement_timeout: i
2929
pool_size=BROOD_POOL_SIZE,
3030
statement_timeout=BROOD_DB_STATEMENT_TIMEOUT_MILLIS,
3131
)
32-
SessionLocal = sessionmaker(bind=engine)
32+
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
3333

3434

3535
def yield_db_session_from_env() -> Session:
@@ -53,7 +53,7 @@ def yield_db_session_from_env() -> Session:
5353
pool_size=BROOD_POOL_SIZE,
5454
statement_timeout=BROOD_DB_STATEMENT_TIMEOUT_MILLIS,
5555
)
56-
RO_SessionLocal = sessionmaker(bind=RO_engine)
56+
RO_SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=RO_engine)
5757

5858

5959
def yield_db_read_only_session() -> Session:

0 commit comments

Comments
 (0)