fixing DQ issues

This commit is contained in:
2025-09-14 15:47:38 +02:00
parent 3eb18ef91e
commit 0ce708cf09
27 changed files with 430 additions and 214 deletions

View File

@@ -1,4 +1,12 @@
# utils/database.py
"""Database utilities ....
This module provides classes and functions for:
- ....
- ....
- ....
"""
import logging
from sqlalchemy import create_engine
@@ -9,7 +17,7 @@ logger = logging.getLogger(__name__)
def get_db_engine(database_url: str):
"""Create database engine with connection pooling"""
"""Create database engine with connection pooling."""
if database_url.startswith("sqlite"):
# SQLite configuration
engine = create_engine(
@@ -26,10 +34,10 @@ def get_db_engine(database_url: str):
echo=False,
)
logger.info(f"Database engine created for: {database_url.split('@')[0]}@...")
logger.info(f"Database engine created for: " f"{database_url.split('@')[0]}@...")
return engine
def get_session_local(engine):
"""Create session factory"""
"""Create session factory."""
return sessionmaker(autocommit=False, autoflush=False, bind=engine)