fixing DQ issues
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
# app/core/database.py
|
||||
"""Summary description ....
|
||||
|
||||
This module provides classes and functions for:
|
||||
- ....
|
||||
- ....
|
||||
- ....
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import declarative_base, sessionmaker
|
||||
|
||||
@@ -8,13 +19,18 @@ SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Database dependency with connection pooling
|
||||
|
||||
|
||||
def get_db():
|
||||
"""Get database object."""
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
except Exception as e:
|
||||
logger.error(f"Health check failed: {e}")
|
||||
db.rollback()
|
||||
raise
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user