Module sktmls.dynamodb.dynamodb

Classes

class DynamoDBClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)

DynamoDB 관련 기능들을 제공하는 클라이언트입니다.

Args

Returns

DynamoDBClient

Example

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

Ancestors

Methods

def delete_item(self, table_name: str, key: Dict[str, Any]) ‑> MLSResponse

주어진 Dynamodb 테이블의 특정 아이템을 삭제합니다

Args

  • table_name: (str) 테이블 명
  • key: (dict) 삭제할 아이템의 key 값

Returns

MLSResponse

Example

dynamodb_client.delete_item(
    table_name="sample_table",
    item={"item_id": "sample"}
)
def get_item(self, table_name: str, key: Dict[str, Any]) ‑> Dict[str, Any]

주어진 Dynamodb 테이블의 특정 아이템을 조회합니다

Args

  • table_name: (str) 테이블 명
  • key: (dict) 조회할 아이템의 key 값

Returns

(dict) 해당 아이템 값

Example

item = dynamodb_client.get_item(table_name="sample_table", key={"item_id": "sample"})
def put_item(self, table_name: str, item: Dict[str, Any]) ‑> Dict[str, Any]

주어진 Dynamodb 테이블에 특정 아이템을 추가합니다

Args

  • table_name: (str) 테이블 명
  • item: (dict) 추가할 아이템 값

Returns

(dict) 추가한 아이템 값

Example

dynamodb_client.put_item(
    table_name="sample_table",
    item={"item_id": "sample", "sample_attribute": "sample_value"}
)
def update_item(self, table_name: str, item: Dict[str, Any]) ‑> Dict[str, Any]

주어진 Dynamodb 테이블의 특정 아이템을 수정합니다

Args

  • table_name: (str) 테이블 명
  • item: (dict) 수정할 아이템 값

Returns

(dict) 수정한 아이템 값

Example

dynamodb_client.update_item(
    table_name="sample_table",
    item={"item_id": "sample", "sample_attribute": "sample_value_updated", "add_new_field": "added_field_value"}
)