diff --git a/backend/scripts/sync_all_zones.py b/backend/scripts/sync_all_zones.py index 4cc7263..e27e571 100644 --- a/backend/scripts/sync_all_zones.py +++ b/backend/scripts/sync_all_zones.py @@ -87,9 +87,12 @@ class ZoneSyncResult: async def get_db_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) return async_session()