aiteamutils 0.2.20__py3-none-any.whl → 0.2.22__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- aiteamutils/database.py +7 -8
- aiteamutils/dependencies.py +1 -1
- aiteamutils/version.py +1 -1
- {aiteamutils-0.2.20.dist-info → aiteamutils-0.2.22.dist-info}/METADATA +1 -1
- {aiteamutils-0.2.20.dist-info → aiteamutils-0.2.22.dist-info}/RECORD +6 -6
- {aiteamutils-0.2.20.dist-info → aiteamutils-0.2.22.dist-info}/WHEEL +0 -0
aiteamutils/database.py
CHANGED
@@ -105,10 +105,10 @@ class DatabaseService:
|
|
105
105
|
@asynccontextmanager
|
106
106
|
async def get_session(self) -> AsyncGenerator[AsyncSession, None]:
|
107
107
|
"""데이터베이스 세션을 생성하고 반환하는 비동기 컨텍스트 매니저."""
|
108
|
-
if self.
|
108
|
+
if self.session_factory is None:
|
109
109
|
raise RuntimeError("Session factory not initialized")
|
110
110
|
|
111
|
-
async with self.
|
111
|
+
async with self.session_factory() as session:
|
112
112
|
try:
|
113
113
|
yield session
|
114
114
|
finally:
|
@@ -792,13 +792,12 @@ class DatabaseService:
|
|
792
792
|
CustomException: 데이터베이스 작업 중 오류 발생 시
|
793
793
|
"""
|
794
794
|
try:
|
795
|
-
if self.db:
|
796
|
-
|
795
|
+
if self.db is not None:
|
796
|
+
return await self.db.execute(query)
|
797
|
+
|
798
|
+
async with self.get_session() as session:
|
799
|
+
result = await session.execute(query)
|
797
800
|
return result
|
798
|
-
else:
|
799
|
-
async with self.session_factory() as session:
|
800
|
-
result = await session.execute(query)
|
801
|
-
return result
|
802
801
|
except Exception as e:
|
803
802
|
raise CustomException(
|
804
803
|
ErrorCode.DB_QUERY_ERROR,
|
aiteamutils/dependencies.py
CHANGED
@@ -4,7 +4,7 @@ from fastapi.security import OAuth2PasswordBearer
|
|
4
4
|
from jose import JWTError, jwt
|
5
5
|
from sqlalchemy.ext.asyncio import AsyncSession
|
6
6
|
|
7
|
-
from .database import DatabaseService, get_database_service
|
7
|
+
from .database import DatabaseService, get_database_service, get_db
|
8
8
|
from .exceptions import CustomException, ErrorCode
|
9
9
|
from .config import get_settings
|
10
10
|
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.22"
|
@@ -4,13 +4,13 @@ aiteamutils/base_repository.py,sha256=qdwQ7Sj2fUqxpDg6cWM48n_QbwPK_VUlG9zTSem8iC
|
|
4
4
|
aiteamutils/base_service.py,sha256=E4dHGE0DvhmRyFplh46SwKJOSF_nUL7OAsCkf_ZJF_8,24733
|
5
5
|
aiteamutils/cache.py,sha256=tr0Yn8VPYA9QHiKCUzciVlQ2J1RAwNo2K9lGMH4rY3s,1334
|
6
6
|
aiteamutils/config.py,sha256=7pJHBml8RRXC9FpoRBx0emofFkvtxsyk9_Rcur2F9hI,2724
|
7
|
-
aiteamutils/database.py,sha256=
|
8
|
-
aiteamutils/dependencies.py,sha256=
|
7
|
+
aiteamutils/database.py,sha256=raYKRZjEfefM3SnoPYozPu7OUGm62XWOUqZzN4_cayw,33479
|
8
|
+
aiteamutils/dependencies.py,sha256=e5P-DQi5OMMh7FADaAUqU0kLVBcReE7za55EDNZN950,4008
|
9
9
|
aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
|
10
10
|
aiteamutils/exceptions.py,sha256=YV-ISya4wQlHk4twvGo16I5r8h22-tXpn9wa-b3WwDM,15231
|
11
11
|
aiteamutils/security.py,sha256=2k5j8iV4jkp0IGRmOtEbVyoeuoDHbguzaYju0Wm-mmI,12715
|
12
12
|
aiteamutils/validators.py,sha256=3N245cZFjgwtW_KzjESkizx5BBUDaJLbbxfNO4WOFZ0,7764
|
13
|
-
aiteamutils/version.py,sha256=
|
14
|
-
aiteamutils-0.2.
|
15
|
-
aiteamutils-0.2.
|
16
|
-
aiteamutils-0.2.
|
13
|
+
aiteamutils/version.py,sha256=Mm5ouHx7VwulFLfCDKBLTQ-wZ87grFovjSV99Abt3Fc,44
|
14
|
+
aiteamutils-0.2.22.dist-info/METADATA,sha256=sil3_P7va6jUaLuUaeEje6zaierWIpsrOUz6CwIRPG4,1718
|
15
|
+
aiteamutils-0.2.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
aiteamutils-0.2.22.dist-info/RECORD,,
|
File without changes
|