Skip to content

Instantly share code, notes, and snippets.

View dubovikmaster's full-sized avatar
😄
life is beautiful and amazing always

Pavel Dubovik dubovikmaster

😄
life is beautiful and amazing always
View GitHub Profile
@nitred
nitred / db_manager.py
Last active December 11, 2024 11:49
Creating thread safe and managed sessions using SQLAlchemy
"""Creating thread safe and managed sessions using SQLAlchemy.
The sessions that are created are expected to be:
- thread safe
- handle committing
- handle rolling back on errors
- handle session removal/releasing once context or thread is closed.
Author: Nitish Reddy Koripalli
License: MIT