1234567891011121314151617 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
- from sqlalchemy.orm import sessionmaker
- from core.config import settings
- async_engine = create_async_engine(settings.ASYNC_MYSQL_URI,
- echo=True,
- pool_size=50,
- max_overflow=20,
- pool_pre_ping=True)
- LocalAsyncSession = sessionmaker(class_=AsyncSession, autocommit=False, bind=async_engine)
- __all__ = ["async_engine", "LocalAsyncSession"]
|