aiteamutils 0.2.128__py3-none-any.whl → 0.2.129__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, noload
14
+ from sqlalchemy.orm import DeclarativeBase, joinedload, selectinload
15
15
  from sqlalchemy.exc import SQLAlchemyError
16
16
  from datetime import datetime
17
17
  from contextlib import asynccontextmanager
@@ -448,16 +448,17 @@ async def list_entities(
448
448
  List[Dict[str, Any]]: 쿼리 결과 리스트.
449
449
  """
450
450
  try:
451
- # 메인 모델과 조인된 모델의 모든 컬럼을 명시적으로 선택
451
+ # 명시적 조인이 있는 경우
452
452
  if explicit_joins:
453
- query = select(model, *explicit_joins).select_from(model)
453
+ query = select(model, *explicit_joins)
454
454
  for join_target in explicit_joins:
455
455
  query = query.outerjoin(join_target)
456
+ # 명시적 조인이 없는 경우
456
457
  else:
457
458
  query = select(model)
458
-
459
- # 불필요한 lazy loading 방지를 위해 noload 옵션 추가
460
- query = query.options(noload('*'))
459
+ if loading_joins:
460
+ for join_option in loading_joins:
461
+ query = query.options(join_option)
461
462
 
462
463
  # 필터 조건 적용
463
464
  if filters:
@@ -485,7 +486,7 @@ async def list_entities(
485
486
 
486
487
  result = await session.execute(query)
487
488
 
488
- return result.unique().scalars().all()
489
+ return result.scalars().unique().all()
489
490
  except SQLAlchemyError as e:
490
491
  raise CustomException(
491
492
  ErrorCode.DB_READ_ERROR,
@@ -502,18 +503,17 @@ async def get_entity(
502
503
  loading_joins: Optional[List[Any]] = None
503
504
  ) -> ModelType:
504
505
  try:
505
- # project 정보도 함께 select
506
- query = select(model, *[join_target for join_target in (explicit_joins or [])])
507
-
508
- # 명시적 조인 적용
506
+ # 명시적 조인이 있는 경우
509
507
  if explicit_joins:
508
+ query = select(model, *explicit_joins)
510
509
  for join_target in explicit_joins:
511
- query = query.outerjoin(join_target) # LEFT OUTER JOIN 적용
512
-
513
- # 조인 로딩 적용 (제거 가능)
514
- if loading_joins:
515
- for join_option in loading_joins:
516
- query = query.options(join_option)
510
+ query = query.outerjoin(join_target)
511
+ # 명시적 조인이 없는 경우
512
+ else:
513
+ query = select(model)
514
+ if loading_joins:
515
+ for join_option in loading_joins:
516
+ query = query.options(join_option)
517
517
 
518
518
  if conditions:
519
519
  for key, value in conditions.items():
aiteamutils/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """버전 정보"""
2
- __version__ = "0.2.128"
2
+ __version__ = "0.2.129"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiteamutils
3
- Version: 0.2.128
3
+ Version: 0.2.129
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=rs0PcH1sXvDxrDVrt2obOVG3pjkxITci7gI0O4LBgMI,20224
7
+ aiteamutils/database.py,sha256=9E5vFC22qeAhU-M4bfzNO53rg43y3CSAsSqrwHmEOHI,20175
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=MP8cUhHdHhWOdkGTtsxbeIs15ZLja70gxlZbWTXsnfA,43
13
- aiteamutils-0.2.128.dist-info/METADATA,sha256=NWIu-gt09mx7QmhNnBLVdSCy68UgHI1hDzUT-X0HtIk,1719
14
- aiteamutils-0.2.128.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- aiteamutils-0.2.128.dist-info/RECORD,,
12
+ aiteamutils/version.py,sha256=d_-Dlw9uKxvmVtrtYblYVCPX-bJvQt2CYRY9_LVZUJE,43
13
+ aiteamutils-0.2.129.dist-info/METADATA,sha256=VXFPjrbhCzEIQw3ZGSkV4VrsqTAfoH-02cfYsgCx3sI,1719
14
+ aiteamutils-0.2.129.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ aiteamutils-0.2.129.dist-info/RECORD,,