diff options
Diffstat (limited to 'api/util/db_dependency.py')
-rw-r--r-- | api/util/db_dependency.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/api/util/db_dependency.py b/api/util/db_dependency.py new file mode 100644 index 0000000..a6734ea --- /dev/null +++ b/api/util/db_dependency.py @@ -0,0 +1,9 @@ +from database import SessionLocal + + +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() |