aiteamutils 0.2.132__py3-none-any.whl → 0.2.134__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
@@ -152,36 +152,27 @@ def process_response(
|
|
152
152
|
if not entity:
|
153
153
|
return None
|
154
154
|
|
155
|
-
print(f"\n[DEBUG] Processing entity: {entity.__class__.__name__}")
|
156
|
-
print(f"[DEBUG] Entity dict: {entity.__dict__}")
|
157
|
-
|
158
155
|
# 모든 필드 처리
|
159
156
|
result = process_columns(entity)
|
160
|
-
print(f"[DEBUG] After process_columns: {result}")
|
161
157
|
|
162
158
|
# Relationship 처리 (이미 로드된 관계만 처리)
|
163
159
|
for relationship in entity.__mapper__.relationships:
|
164
160
|
print(f"\n[DEBUG] Processing relationship: {relationship.key}")
|
165
161
|
if not relationship.key in entity.__dict__:
|
166
|
-
print(f"[DEBUG] Relationship {relationship.key} not in entity.__dict__")
|
167
162
|
continue
|
168
163
|
|
169
164
|
try:
|
170
165
|
value = getattr(entity, relationship.key)
|
171
|
-
print(f"[DEBUG] Relationship value: {value}")
|
172
166
|
|
173
167
|
# response_model이 있는 경우 해당 필드의 annotation type을 가져옴
|
174
168
|
nested_response_model = None
|
175
169
|
if response_model and relationship.key in response_model.model_fields:
|
176
170
|
field_info = response_model.model_fields[relationship.key]
|
177
171
|
nested_response_model = field_info.annotation
|
178
|
-
print(f"[DEBUG] Found nested response model for {relationship.key}: {nested_response_model}")
|
179
172
|
|
180
173
|
# Optional[ProjectResponse] 같은 경우 실제 모델 추출
|
181
174
|
if hasattr(nested_response_model, '__origin__') and nested_response_model.__origin__ is Union:
|
182
|
-
print(f"[DEBUG] Extracting actual model from Union type: {nested_response_model.__args__}")
|
183
175
|
nested_response_model = next((t for t in nested_response_model.__args__ if hasattr(t, 'model_fields')), None)
|
184
|
-
print(f"[DEBUG] Extracted model: {nested_response_model}")
|
185
176
|
|
186
177
|
if value is not None:
|
187
178
|
if isinstance(value, list):
|
@@ -190,21 +181,15 @@ def process_response(
|
|
190
181
|
for item in value
|
191
182
|
]
|
192
183
|
else:
|
193
|
-
print(f"[DEBUG] Processing single value with model: {nested_response_model}")
|
194
184
|
result[relationship.key] = process_response(value, nested_response_model)
|
195
|
-
print(f"[DEBUG] After processing relationship {relationship.key}: {result[relationship.key]}")
|
196
185
|
else:
|
197
186
|
result[relationship.key] = None
|
198
187
|
except Exception as e:
|
199
|
-
print(f"[DEBUG] Error processing relationship {relationship.key}: {str(e)}")
|
200
188
|
import traceback
|
201
|
-
print(f"[DEBUG] Full traceback: {traceback.format_exc()}")
|
202
189
|
result[relationship.key] = None
|
203
190
|
|
204
|
-
print(f"\n[DEBUG] Before response model processing: {result}")
|
205
191
|
# response_model이 있는 경우 필터링
|
206
192
|
if response_model:
|
207
|
-
print(f"[DEBUG] Response model fields: {response_model.model_fields}")
|
208
193
|
# 현재 키 목록을 저장
|
209
194
|
current_keys = list(result.keys())
|
210
195
|
# response_model에 없는 키 제거
|
@@ -215,14 +200,10 @@ def process_response(
|
|
215
200
|
# 모델 검증 및 업데이트
|
216
201
|
try:
|
217
202
|
validated_result = response_model(**result).model_dump()
|
218
|
-
print(f"[DEBUG] After validation: {validated_result}")
|
219
203
|
result.update(validated_result)
|
220
204
|
except Exception as e:
|
221
|
-
print(f"[DEBUG] Error during validation: {str(e)}")
|
222
205
|
import traceback
|
223
|
-
|
224
|
-
|
225
|
-
print(f"[DEBUG] Final result: {result}")
|
206
|
+
|
226
207
|
return result
|
227
208
|
|
228
209
|
##################
|
@@ -480,17 +461,13 @@ async def list_entities(
|
|
480
461
|
List[Dict[str, Any]]: 쿼리 결과 리스트.
|
481
462
|
"""
|
482
463
|
try:
|
483
|
-
|
484
|
-
|
485
|
-
# 명시적 조인 적용
|
464
|
+
# 기본 쿼리 생성
|
486
465
|
if explicit_joins:
|
466
|
+
query = select(model, *explicit_joins)
|
487
467
|
for join_target in explicit_joins:
|
488
468
|
query = query.outerjoin(join_target)
|
489
|
-
|
490
|
-
|
491
|
-
if loading_joins:
|
492
|
-
for join_option in loading_joins:
|
493
|
-
query = query.options(join_option)
|
469
|
+
else:
|
470
|
+
query = select(model)
|
494
471
|
|
495
472
|
# 필터 조건 적용
|
496
473
|
if filters:
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.134"
|
@@ -4,12 +4,12 @@ aiteamutils/base_repository.py,sha256=vzBw3g3jCJetTDblZvZenEGXk89Qu_65_02C7QTcf8
|
|
4
4
|
aiteamutils/base_service.py,sha256=nHikjwGp29QrQPr2W8Ye9sKxmVS_8prRG3Nu42TU1Ms,10670
|
5
5
|
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
6
|
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
|
-
aiteamutils/database.py,sha256=
|
7
|
+
aiteamutils/database.py,sha256=2hrPy_V-n4kKC0I8MkGiS_5-7ZqKypbiYr0nekMVa4Y,20544
|
8
8
|
aiteamutils/enums.py,sha256=7WLqlcJqQWtETAga2WAxNp3dJTQIAd2TW-4WzkoHHa8,2498
|
9
9
|
aiteamutils/exceptions.py,sha256=pgf3ersezObyl17wAO3I2fb8m9t2OzWDX1mSjwAWm2Y,16035
|
10
10
|
aiteamutils/security.py,sha256=McUl3t5Z5SyUDVUHymHdDkYyF4YSeg4g9fFMML4W6Kw,11630
|
11
11
|
aiteamutils/validators.py,sha256=msOrha36xWsapm4VAh63YmFq1GVyC9tzZcjXYFCEZ_g,11949
|
12
|
-
aiteamutils/version.py,sha256=
|
13
|
-
aiteamutils-0.2.
|
14
|
-
aiteamutils-0.2.
|
15
|
-
aiteamutils-0.2.
|
12
|
+
aiteamutils/version.py,sha256=egCk8YV5GyRjVbkuh35PwKcfmp7pVNPyW7e2yjO10Gg,43
|
13
|
+
aiteamutils-0.2.134.dist-info/METADATA,sha256=-DYgH2SVlCJWygI5qWqZDCt78OPLj_c5YiFOmLg-ziw,1719
|
14
|
+
aiteamutils-0.2.134.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
aiteamutils-0.2.134.dist-info/RECORD,,
|
File without changes
|