Module sktmls.profiles.profile

Classes

class Profile (**kwargs)

MLS 프로파일 클래스입니다.

Args

  • kwargs
    • id: (int) 프로파일 고유 ID
    • profile_id: (str) 프로파일 이름
    • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
    • user: (str) 프로파일 소유 계정명

Returns

Profile

Methods

def get(self)
def reset(self, **kwargs)
class ProfileClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)

MLS 프로파일 관련 기능들을 제공하는 클라이언트입니다.

Args

Returns

ProfileClient

Example

profile_client = ProfileClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")

Ancestors

Methods

def create_profile(self, profile_id: str, tables: List[str], main_table: str = None) ‑> Profile

프로파일을 생성합니다.

Args

  • profile_id: (str) 프로파일 이름
  • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
    • 테이블 간 중복 키에 대한 값 우선 순위는 왼쪽 테이블이 오른쪽 테이블보다 높습니다.
    • 연결된 모든 테이블 내에 없는 키에 대한 값은 null로 반환됩니다.
  • main_table: (optional) (str) 서비스 대상 여부를 결정하는 테이블
    • 기준 테이블에 데이터가 존재하지 않는 경우 다른 테이블에 데이터가 있다 하더라도 서비스되지 않습니다.
    • 기준 테이블에 데이터가 존재하는 경우 다른 테이블의 데이터 여부와 관계 없이 반드시 서비스됩니다.
    • 미선택 시 tables 파라미터에 명시된 테이블 중 첫 번째 테이블로 설정됩니다.

Returns

Profile

  • id: (int) 프로파일 고유 ID
  • profile_id: (str) 프로파일 이름
  • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
  • main_table: (str) 연결 테이블 중 기준이 되는 테이블 (추후 로직 추가 예정)
  • user: (str) 프로파일 소유 계정명

Example

profile = profile_client.create_profile(
    profile_id="my_profile",
    tables=["user-profile", "user-profile-daily"]
)
def delete_profile(self, profile: Profile) ‑> MLSResponse

프로파일을 삭제합니다.

Args

  • profile: (Profile) 프로파일 객체

Returns

MLSResponse

Example

profile_client.delete_profile(my_profile)
def get_profile(self, id: int = None, profile_id: str = None) ‑> Profile

프로파일 정보를 가져옵니다.

Args: id 또는 profile_id 중 한 개 이상의 값이 반드시 전달되어야 합니다.

  • api_type: (str) 프로파일 타입 (user|item)
  • id: (int) 프로파일 고유 ID
  • profile_id: (str) 프로파일 이름

Returns

Client

  • id: (int) 프로파일 고유 ID
  • api_type: (str) 프로파일 타입 (user|item)
  • profile_id: (str) 프로파일 이름
  • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
  • main_table: (str) 연결 테이블 중 기준이 되는 테이블 (추후 로직 추가 예정)
  • user: (str) 프로파일 소유 계정명

Example

profile_by_id = profile_client.get_profile(api_type="user", id=3)
profile_by_profile_id = profile_client.get_profile(api_type="item", profile_id="my_item_profile")
def list_profiles(self, **kwargs) ‑> List[Profile]

프로파일 리스트를 가져옵니다.

Args

  • kwargs: (optional) (dict) 쿼리 조건
    • id: (int) 프로파일 고유 ID
    • profile_id: (str) 프로파일 이름
    • query: (str) 검색 문자
    • page: (int) 페이지 번호

Returns

list(Profile)

  • id: (int) 프로파일 고유 ID
  • profile_id: (str) 프로파일 이름
  • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
  • main_table: (str) 연결 테이블 중 기준이 되는 테이블 (추후 로직 추가 예정)
  • user: (str) 프로파일 소유 계정명

Example

all_my_user_profiles = profile_client.list_profiles(api_type="user")
def update_profile(self, profile: Profile, profile_id: str = None, tables: List[str] = None, main_table: str = None) ‑> Profile

프로파일 정보를 수정합니다.

Args

  • profile_id: (optional) (str) 프로파일 이름
  • tables: (optional) (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
    • 테이블 간 중복 키에 대한 값 우선 순위는 왼쪽 테이블이 오른쪽 테이블보다 높습니다.
    • 연결된 모든 테이블 내에 없는 키에 대한 값은 null로 반환됩니다.
  • main_table: (optional) (str) 서비스 대상 여부를 결정하는 테이블
    • 기준 테이블에 데이터가 존재하지 않는 경우 다른 테이블에 데이터가 있다 하더라도 서비스되지 않습니다.
    • 기준 테이블에 데이터가 존재하는 경우 다른 테이블의 데이터 여부와 관계 없이 반드시 서비스됩니다.
    • 미선택 시 tables 파라미터에 명시된 테이블 중 첫 번째 테이블로 설정됩니다.

Returns

Profile

  • id: (int) 프로파일 고유 ID
  • profile_id: (str) 프로파일 이름
  • tables: (list) 프로파일에 연결할 DynamoDB 테이블 이름 리스트
  • main_table: (str) 연결 테이블 중 기준이 되는 테이블 (추후 로직 추가 예정)
  • user: (str) 프로파일 소유 계정명

Example

profile = profile_client.profile_profile(
    profile=my_profile,
    profile_id="updated_profile",
    tables=["user-profile", "user-profile-daily"]
)