Kaynağa Gözat

update py/DynamoDB-UpdateItem.py.

xdc 5 yıl önce
ebeveyn
işleme
f542c347b0
1 değiştirilmiş dosya ile 17 ekleme ve 1 silme
  1. 17 1
      py/DynamoDB-UpdateItem.py

+ 17 - 1
py/DynamoDB-UpdateItem.py

@@ -29,7 +29,23 @@ def updata_ddb(name,msg,alias):
             'S': alias}
             })
 
-
+def updata_ddbone(age):
+    client = boto3.client('dynamodb')
+    response = client.update_item(
+            TableName='age',
+            Key={
+                'key': {
+                    'S': "name"
+                }
+            },
+            AttributeUpdates={
+                'age': {
+                    'Value': {
+                        'S': age
+                    }
+                }
+            }
+        )
  
 if __name__ == '__main__':
     update_response = increase_rating("cxy")