|
|
@@ -0,0 +1,21 @@
|
|
|
+import boto3
|
|
|
+
|
|
|
+
|
|
|
+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
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ update_response = increase_rating("cxy")
|
|
|
+ print("Update movie succeeded:")
|