import boto3


# use Resource    
def increase_rating(keya,dynamodb=None):
    if not dynamodb:
        dynamodb = boto3.resource('dynamodb')

    table = dynamodb.Table('hehe')
    
    response = table.update_item(
        Key={'name': keya},
        UpdateExpression="set alias=:val",
        ExpressionAttributeValues={
            ':val': 'hehe'},
        ReturnValues="UPDATED_NEW")
    return response

# use Client        
def updata_ddb(name,msg,alias):
    table = boto3.client('dynamodb')
    table.update_item(TableName='hehe',
        Key={'name': {'S':name}},
        UpdateExpression='SET name = :name, alias = :alias',
        ExpressionAttributeValues={
        ':name': {
            'S': msg},
        ':alias':{
            'S': alias}
            })


 
if __name__ == '__main__':
    update_response = increase_rating("cxy")
    print("Update movie succeeded:")