def get_table_keys(table_name: str, dynamodb_client: BaseClient) -> (str, str):
    resp = dynamodb_client.describe_table(TableName=table_name)
    sort_key = ''
    for key_schema in resp['Table']['KeySchema']:
        if key_schema['KeyType'] == 'HASH':
            partition_key = key_schema['AttributeName']
        elif key_schema['KeyType'] == 'RANGE':
            sort_key = key_schema['AttributeName']
    return partition_key, sort_key
Exemple #2
0
def get_table_data(client: BaseClient, table_name: str) -> Dict:
    """Retrieve detailed properties of DynamoDB table"""
    table_resp = client.describe_table(TableName=table_name)
    table_data = table_resp.get("Table", None)
    return table_data