Module sktmls.dimensions
Sub-modules
sktmls.dimensions.dimension
Classes
class Dimension (**kwargs)
-
MLS 디멘전 클래스입니다.
Args
- kwargs
- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
) - default: (str) 디멘전 기본 값
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (str) 디멘전 설명
- task_id: (str) 디멘전 생성 Airflow Task ID
- tag: (str) 디멘전 태그
- is_derivative: (bool) 디멘전 파생변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Returns
Methods
def get(self)
def reset(self, **kwargs)
- kwargs
class DimensionClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)
-
MLS 디멘전 관련 기능들을 제공하는 클라이언트입니다.
Args
- env: (
MLSENV
) 접근할 MLS 환경 (MLSENV.DEV
|MLSENV.STG
|MLSENV.PRD
) (기본값:MLSENV.STG
) - runtime_env: (
MLSRuntimeENV
) 클라이언트가 실행되는 환경 (MLSRuntimeENV.YE
|MLSRuntimeENV.EDD
|MLSRuntimeENV.LOCAL
) (기본값:MLSRuntimeENV.LOCAL
) - username: (str) MLS 계정명 (기본값: $MLS_USERNAME)
- password: (str) MLS 계정 비밀번호 (기본값: $MLS_PASSWORD)
아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.
- $MLS_ENV: env
- $MLS_RUNTIME_ENV: runtime_env
- $MLS_USERNAME: username
- $MLS_PASSWORD: password
Returns
Example
dimension_client = DimensionClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")
Ancestors
Methods
def create_dimension(self, name: str, dimension_type: str, data_type: str, default: str, period: str, description: str = None, task_id: str = None, tag: str = None, is_derivative: bool = None, is_enabled: bool = None) ‑> Dimension
-
디멘전을 생성합니다.
Args
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - default: (str) 디멘전 기본 값
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (optional) (str) 디멘전 설명
- task_id: (optional) (str) 디멘전 생성 Airflow Task ID
- tag: (optional) (str) 디멘전 태그
- is_derivative: (optional) (bool) 디멘전 파생변수 여부 (기본값: False)
- is_enabled: (optional) (bool) 디멘전 서비스 여부 (기본값: True)
Returns
- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - description: (str) 디멘전 설명
- default: (str) 디멘전 기본 값
- task_id: (str) 디멘전 생성 Airflow Task ID
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - tag: (str) 디멘전 태그
- is_derivative: (bool) 디멘전 파생변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
dimension = dimension_client.create_dimension( name="hello", dimension_type="user", data_type="string", default="1", period="daily" )
def delete_dimension(self, dimension: Dimension) ‑> MLSResponse
-
디멘전을 삭제합니다.
Args
- dimension: (
Dimension
) 디멘전 객체
Returns
Example
dimension_client.delete_dimension(dimension)
- dimension: (
def get_dimension(self, dimension_type: str, id: int = None, name: str = None) ‑> Dimension
-
디멘전 정보를 가져옵니다.
Args:
id
또는name
중 한 개 이상의 값이 반드시 전달되어야 합니다.- dimension_type: (str) 디멘전 타입 (
user
|item
) - id: (optional) (int) 디멘전 고유 ID
- name: (optional) (str) 디멘전 이름
Returns
- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - default: (str) 디멘전 기본 값
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (str) 디멘전 설명
- task_id: (str) 디멘전 생성 Airflow Task ID
- tag: (str) 디멘전 태그
- is_derivative: (bool) 디멘전 파생변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
dimension = dimension_client.get_dimension( dimension_type="user", name="hello" )
- dimension_type: (str) 디멘전 타입 (
def list_dimensions(self, dimension_type: str, **kwargs) ‑> List[Dimension]
-
디멘전 리스트를 가져옵니다.
Args
- dimension_type: (str) 디멘전 타입 (
user
|item
) - kwargs: (optional) (dict) 쿼리 조건
- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - period: (str) 디멘전 생성 주기 (
daily
|monthly
) - task_id: (str) 디멘전 생성 Airflow Task ID
- tag: (str) 디멘전 태그
- is_derivative: (bool) 파생 변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- query: (str) 검색 문자
- page: (int) 페이지 번호
Returns
list(
Dimension
)- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - default: (str) 디멘전 기본 값
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (str) 디멘전 설명
- task_id: (str) 디멘전 생성 Airflow Task ID
- tag: (str) 디멘전 태그
- is_derivative: (bool) 디멘전 파생변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
dimensions = dimension_client.list_dimensions( dimension_type="user" ) derivative_dimensions = dimension_client.list_dimensions( dimension_type="user", is_derivative=True ) string_dimensions = dimension_client.list_dimensions( dimension_type="user", data_type="string" )
- dimension_type: (str) 디멘전 타입 (
def update_dimension(self, dimension: Dimension, name: str = None, dimension_type: str = None, data_type: str = None, default: str = None, period: str = None, description: str = None, task_id: str = None, tag: str = None, is_derivative: bool = None, is_enabled: bool = None) ‑> Dimension
-
디멘전 정보를 수정합니다.
Args
- dimension: (
Dimension
) 디멘전 객체 - name: (optional) (str) 디멘전 이름
- dimension_type: (optional) (str) 디멘전 타입 (
user
|item
) - data_type: (optional) (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - default: (optional) (str) 디멘전 기본 값
- period: (optional) (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (optional) (str) 디멘전 설명
- task_id: (optional) (str) 디멘전 생성 Airflow Task ID
- tag: (optional) (str) 디멘전 태그
- is_derivative: (optional) (bool) 디멘전 파생변수 여부
- is_enabled: (optional) (bool) 디멘전 서비스 여부
Returns
- id: (int) 디멘전 고유 ID
- name: (str) 디멘전 이름
- dimension_type: (str) 디멘전 타입 (
user
|item
) - data_type: (str) 디멘전 데이터 타입 (
string
|number
|array
|json
) - default: (str) 디멘전 기본 값
- period: (str) 디멘전 생성 주기 (
daily
|monthly
) - description: (str) 디멘전 설명
- task_id: (str) 디멘전 생성 Airflow Task ID
- tag: (optional) (str) 디멘전 태그
- is_derivative: (bool) 디멘전 파생변수 여부
- is_enabled: (bool) 디멘전 서비스 여부
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
dimension = dimension_client.update_dimension( dimension=dimension, name="bye", default="2", period="monthly" )
- dimension: (
- env: (