aiteamutils 0.2.125__py3-none-any.whl → 0.2.127__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
@@ -11,7 +11,7 @@ from typing import (
11
11
  )
12
12
  from sqlalchemy.ext.asyncio import AsyncSession
13
13
  from sqlalchemy import select, and_, or_
14
- from sqlalchemy.orm import DeclarativeBase, joinedload, selectinload
14
+ from sqlalchemy.orm import DeclarativeBase, joinedload, selectinload, noload
15
15
  from sqlalchemy.exc import SQLAlchemyError
16
16
  from datetime import datetime
17
17
  from contextlib import asynccontextmanager
@@ -448,17 +448,16 @@ async def list_entities(
448
448
  List[Dict[str, Any]]: 쿼리 결과 리스트.
449
449
  """
450
450
  try:
451
- query = select(model)
452
-
453
- # 명시적 조인 적용
451
+ # 메인 모델과 조인된 모델의 모든 컬럼을 명시적으로 선택
454
452
  if explicit_joins:
453
+ query = select(model, *explicit_joins)
455
454
  for join_target in explicit_joins:
456
455
  query = query.outerjoin(join_target)
456
+ else:
457
+ query = select(model)
457
458
 
458
- # 조인 로딩 적용
459
- if loading_joins:
460
- for join_option in loading_joins:
461
- query = query.options(join_option)
459
+ # 불필요한 lazy loading 방지를 위해 noload 옵션 추가
460
+ query = query.options(noload('*'))
462
461
 
463
462
  # 필터 조건 적용
464
463
  if filters:
@@ -486,7 +485,7 @@ async def list_entities(
486
485
 
487
486
  result = await session.execute(query)
488
487
 
489
- return result.scalars().unique().all()
488
+ return result.unique().scalars().all()
490
489
  except SQLAlchemyError as e:
491
490
  raise CustomException(
492
491
  ErrorCode.DB_READ_ERROR,
@@ -503,12 +502,15 @@ async def get_entity(
503
502
  loading_joins: Optional[List[Any]] = None
504
503
  ) -> ModelType:
505
504
  try:
506
- query = select(model)
505
+ # project 정보도 함께 select
506
+ query = select(model, *[join_target for join_target in (explicit_joins or [])])
507
507
 
508
+ # 명시적 조인 적용
508
509
  if explicit_joins:
509
510
  for join_target in explicit_joins:
510
- query = query.join(join_target)
511
+ query = query.outerjoin(join_target) # LEFT OUTER JOIN 적용
511
512
 
513
+ # 조인 로딩 적용 (제거 가능)
512
514
  if loading_joins:
513
515
  for join_option in loading_joins:
514
516
  query = query.options(join_option)
aiteamutils/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """버전 정보"""
2
- __version__ = "0.2.125"
2
+ __version__ = "0.2.127"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiteamutils
3
- Version: 0.2.125
3
+ Version: 0.2.127
4
4
  Summary: AI Team Utilities
5
5
  Project-URL: Homepage, https://github.com/yourusername/aiteamutils
6
6
  Project-URL: Issues, https://github.com/yourusername/aiteamutils/issues
@@ -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=nbPcd1nLMnXxL3FRjZpUD8jAFy3dUAPAPUl6k8HRT-I,19901
7
+ aiteamutils/database.py,sha256=5EgXARjB6j6lrT9szudw43ePevlCM6ZAEORvkbjUdac,20205
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=V0JA8FSRO5cp690vOytQsb10C0b1Tj7rxy6iV4tkbXU,43
13
- aiteamutils-0.2.125.dist-info/METADATA,sha256=s5k0XIC8XTLUG0izCb_VDKSSDwh552IJXd7nqdTj3r0,1719
14
- aiteamutils-0.2.125.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- aiteamutils-0.2.125.dist-info/RECORD,,
12
+ aiteamutils/version.py,sha256=U2YmwGAP9EE5Rgm1XzXUOp1tHwtGZK11l-ayHFCz648,43
13
+ aiteamutils-0.2.127.dist-info/METADATA,sha256=ONyu_iaMHuw7bPBCT9BeynVTJ1m4M69AkFpjojhEuhI,1719
14
+ aiteamutils-0.2.127.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ aiteamutils-0.2.127.dist-info/RECORD,,