Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused imports from routerification and fix dotenv issue #43

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from sqlalchemy.ext.declarative import declarative_base

load_dotenv()
load_dotenv(override=True)

connect_args = {}

Expand Down
15 changes: 15 additions & 0 deletions api/src/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from fastapi import Depends
from .db import SessionLocal
from sqlalchemy.ext.asyncio import AsyncSession


async def get_db():
"""FastAPI Dependency Generator for Database"""
db: AsyncSession = SessionLocal()
try:
yield db
finally:
await db.close()


db: AsyncSession = Depends(get_db)
Loading
Loading