Fix: get_db_session() in zone sync script - use get_settings() and handle aiosqlite URL
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
This commit is contained in:
@ -87,9 +87,12 @@ class ZoneSyncResult:
|
|||||||
|
|
||||||
async def get_db_session():
|
async def get_db_session():
|
||||||
"""Create async database session"""
|
"""Create async database session"""
|
||||||
from app.config import settings
|
from app.config import get_settings
|
||||||
|
|
||||||
engine = create_async_engine(settings.database_url.replace("sqlite://", "sqlite+aiosqlite://"))
|
db_url = get_settings().database_url
|
||||||
|
if "aiosqlite" not in db_url:
|
||||||
|
db_url = db_url.replace("sqlite://", "sqlite+aiosqlite://")
|
||||||
|
engine = create_async_engine(db_url)
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||||
return async_session()
|
return async_session()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user