Add database setup

This commit is contained in:
Daniil Fajnberg 2022-06-29 13:06:20 +02:00
parent 8ec4e8885a
commit eb08e5a674

9
src/compub/db.py Normal file
View File

@ -0,0 +1,9 @@
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import declarative_base, sessionmaker
from compub.settings import settings
engine = create_async_engine(settings.db_uri, future=True)
LocalAsyncSession = sessionmaker(engine, expire_on_commit=False, class_=AsyncSession)
ORMBase = declarative_base()