22 lines
454 B
Python
22 lines
454 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=100,
|
|
max_overflow=200,
|
|
pool_timeout=60,
|
|
)
|
|
|
|
async_session_maker = async_sessionmaker(
|
|
bind=engine,
|
|
expire_on_commit=False,
|
|
class_=AsyncSession,
|
|
)
|
|
|
|
Base = declarative_base()
|