aiteamutils 0.2.49__py3-none-any.whl → 0.2.51__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aiteamutils/database.py
CHANGED
@@ -997,62 +997,30 @@ class DatabaseService:
|
|
997
997
|
)
|
998
998
|
|
999
999
|
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
1000
|
-
"""데이터베이스
|
1001
|
-
|
1000
|
+
"""데이터베이스 세션 의존성
|
1001
|
+
|
1002
1002
|
Yields:
|
1003
1003
|
AsyncSession: 데이터베이스 세션
|
1004
|
-
|
1004
|
+
|
1005
1005
|
Raises:
|
1006
|
-
CustomException:
|
1006
|
+
CustomException: 데이터베이스 연결 오류
|
1007
1007
|
"""
|
1008
|
-
|
1009
|
-
raise CustomException(
|
1010
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
1011
|
-
detail="Database service is not initialized",
|
1012
|
-
source_function="get_db"
|
1013
|
-
)
|
1014
|
-
|
1015
|
-
db_service = await DatabaseServiceManager.get_instance()
|
1016
|
-
if not db_service or not db_service.engine:
|
1017
|
-
raise CustomException(
|
1018
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
1019
|
-
detail="Database service or engine is not properly initialized",
|
1020
|
-
source_function="get_db"
|
1021
|
-
)
|
1008
|
+
db_service = await get_database_service()
|
1022
1009
|
|
1023
|
-
|
1024
|
-
session = db_service.get_session()
|
1025
|
-
if session is None:
|
1026
|
-
raise CustomException(
|
1027
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
1028
|
-
detail="Failed to create database session",
|
1029
|
-
source_function="get_db"
|
1030
|
-
)
|
1031
|
-
|
1032
|
-
# 세션이 유효한지 확인
|
1010
|
+
async with db_service.get_session() as session:
|
1033
1011
|
try:
|
1012
|
+
# 세션이 유효한지 확인
|
1034
1013
|
await session.execute(select(1))
|
1014
|
+
yield session
|
1035
1015
|
except Exception as e:
|
1036
|
-
|
1016
|
+
if isinstance(e, CustomException):
|
1017
|
+
raise e
|
1037
1018
|
raise CustomException(
|
1038
1019
|
ErrorCode.DB_CONNECTION_ERROR,
|
1039
|
-
detail="
|
1020
|
+
detail=f"Failed to get database session: {str(e)}",
|
1040
1021
|
source_function="get_db",
|
1041
1022
|
original_error=e
|
1042
1023
|
)
|
1043
|
-
|
1044
|
-
yield session
|
1045
|
-
except Exception as e:
|
1046
|
-
if isinstance(e, CustomException):
|
1047
|
-
raise e
|
1048
|
-
raise CustomException(
|
1049
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
1050
|
-
detail=f"Failed to get database session: {str(e)}",
|
1051
|
-
source_function="get_db",
|
1052
|
-
original_error=e
|
1053
|
-
)
|
1054
|
-
finally:
|
1055
|
-
await session.close()
|
1056
1024
|
|
1057
1025
|
async def get_database_service() -> DatabaseService:
|
1058
1026
|
"""DatabaseService 의존성
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.51"
|
@@ -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=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
6
|
aiteamutils/config.py,sha256=OM_b7g8sqZ3zY_DSF9ry-zn5wn4dlXdx5OhjfTGr0TE,2876
|
7
|
-
aiteamutils/database.py,sha256=
|
7
|
+
aiteamutils/database.py,sha256=Be0hr833X3zMz2gaJYugvE9E7o05uBmXKPhZiGFJQTM,38984
|
8
8
|
aiteamutils/dependencies.py,sha256=0mNmZiPlA8wTj4cgmjGXs6y9kkIQ5RtLZHdEeHxyblo,4490
|
9
9
|
aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
|
10
10
|
aiteamutils/exceptions.py,sha256=_lKWXq_ujNj41xN6LDE149PwsecAP7lgYWbOBbLOntg,15368
|
11
11
|
aiteamutils/security.py,sha256=KSZf3WJAlW0UXVM1GEHwuGy2x27UHwtMr8aq-GuIXZk,16016
|
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=8MKWHJHM8zYlzctvZN4uCH_rdHayPQd-Sxyv9JJ2554,42
|
14
|
+
aiteamutils-0.2.51.dist-info/METADATA,sha256=u7kI-u4xQZcrWK20EtNRzzzJNJvZ22GRD3eI8I7-u-M,1718
|
15
|
+
aiteamutils-0.2.51.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
aiteamutils-0.2.51.dist-info/RECORD,,
|
File without changes
|