generated from daniil-berg/boilerplate-py
Add database setup
This commit is contained in:
parent
8ec4e8885a
commit
eb08e5a674
9
src/compub/db.py
Normal file
9
src/compub/db.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user