22 lines
519 B
Python
22 lines
519 B
Python
|
|
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
|
from sqlalchemy.orm import sessionmaker, declarative_base
|
|
|
|
DATABASE_URL = "sqlite+aiosqlite:///files/db.sqlite"
|
|
|
|
engine = create_async_engine(DATABASE_URL, echo=False)
|
|
SessionLocal = sessionmaker(
|
|
bind=engine,
|
|
class_=AsyncSession,
|
|
expire_on_commit=False,
|
|
)
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
import logging
|
|
|
|
logging.basicConfig()
|
|
logging.getLogger('sqlalchemy').setLevel(logging.WARNING)
|
|
|
|
logging.getLogger('sqlalchemy.engine').disabled = True |