20 lines
408 B
Python
20 lines
408 B
Python
"""
|
|
DB 연결 (공유 엔진 및 세션 팩토리)
|
|
"""
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
|
|
|
from config import settings
|
|
|
|
engine = create_async_engine(
|
|
url=settings.MYSQL_URL,
|
|
pool_pre_ping=True,
|
|
pool_recycle=280,
|
|
)
|
|
|
|
SessionLocal = async_sessionmaker(
|
|
bind=engine,
|
|
class_=AsyncSession,
|
|
expire_on_commit=False,
|
|
)
|