Skip to content

Commit

Permalink
Fix sessionmaker autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lekuruu committed Dec 17, 2023
1 parent 2d32c76 commit 6a6dc26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions database/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ def __init__(self, username: str, password: str, host: str, port: int) -> None:
)

self.engine.dispose()

Base.metadata.create_all(bind=self.engine)

self.sessionmaker = sessionmaker(
bind=self.engine,
autoflush=False,
autocommit=False,
expire_on_commit=False
)

self.logger = logging.getLogger('postgres')
self.sessionmaker = sessionmaker(bind=self.engine)

@property
def session(self) -> Session:
Expand Down

0 comments on commit 6a6dc26

Please sign in to comment.