diff options
| author | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
| commit | a7c25076d16bde9ec928b9ef01bce952406ea7b1 (patch) | |
| tree | 802c5f84902f240c6aab95acc1e6348dfbd806c2 /app/db.py | |
| download | hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.gz hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.bz2 hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.zip | |
initial commit
Diffstat (limited to 'app/db.py')
| -rw-r--r-- | app/db.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/db.py b/app/db.py new file mode 100644 index 0000000..5846834 --- /dev/null +++ b/app/db.py @@ -0,0 +1,16 @@ +from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine, AsyncSession +from sqlalchemy.orm import DeclarativeBase +from app.config import settings + + +class Base(DeclarativeBase): + pass + + +engine = create_async_engine(settings.database_url, future=True) +SessionLocal = async_sessionmaker(engine, expire_on_commit=False, class_=AsyncSession) + + +async def get_db() -> AsyncSession: + async with SessionLocal() as session: + yield session |
