19 lines
437 B
Python
19 lines
437 B
Python
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
|
from sqlalchemy.orm import declarative_base
|
|
|
|
from config import DATABASE_URL
|
|
|
|
|
|
engine = create_async_engine(
|
|
DATABASE_URL,
|
|
echo=False,
|
|
future=True,
|
|
pool_size=20,
|
|
max_overflow=30,
|
|
pool_timeout=15
|
|
)
|
|
|
|
async_session_maker = async_sessionmaker(bind=engine, expire_on_commit=False, class_=AsyncSession)
|
|
|
|
Base = declarative_base()
|