fixing DQ issues
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user