Skip to content
Open
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 backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pull official latest Python Docker image (Pulished with version 3.11.0)
# Pull official latest Python Docker image (Published with version 3.11.0)
FROM --platform=linux/amd64 python:latest

# Set the working directory
Expand Down
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Check the `pyproject.toml` as the main configuration file for the following pack
* Isort
* MyPy
* PyTest
* Converage
* Coverage

---

Expand Down
9 changes: 2 additions & 7 deletions backend/src/api/dependencies/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,5 @@


async def get_async_session() -> typing.AsyncGenerator[SQLAlchemyAsyncSession, None]:
try:
yield async_db.async_session
except Exception as e:
print(e)
await async_db.async_session.rollback()
finally:
await async_db.async_session.close()
async with async_db.async_session() as session:
yield session
6 changes: 4 additions & 2 deletions backend/src/repository/database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pydantic
from sqlalchemy.ext.asyncio import (
async_sessionmaker as sqlalchemy_async_sessionmaker,
async_sessionmaker as SQLAlchemyAsyncSessionMaker,
AsyncEngine as SQLAlchemyAsyncEngine,
AsyncSession as SQLAlchemyAsyncSession,
create_async_engine as create_sqlalchemy_async_engine,
Expand All @@ -23,7 +23,9 @@ def __init__(self):
max_overflow=settings.DB_POOL_OVERFLOW,
poolclass=SQLAlchemyQueuePool,
)
self.async_session: SQLAlchemyAsyncSession = SQLAlchemyAsyncSession(bind=self.async_engine)
self.async_session: SQLAlchemyAsyncSessionMaker = SQLAlchemyAsyncSessionMaker(
bind=self.async_engine, expire_on_commit=False, class_=SQLAlchemyAsyncSession
)
self.pool: SQLAlchemyPool = self.async_engine.pool

@property
Expand Down