0
のboto私はのbotoを使用してPythonコードを次ていますチェックは -
import boto3
# Get the service resource.
dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
# Instantiate a table resource object without actually
# creating a DynamoDB table. Note that the attributes of this table
# are lazy-loaded: a request is not made nor are the attribute
# values populated until the attributes
# on the table resource are accessed or its load() method is called.
table = dynamodb.Table('djin-dev-genesis')
def addtodatabase(appname, chef_max, arp_score):
response = table.get_item(Key={'appname': str(appname)})
if 'Item' not in response.keys():
print "partititon key (appname) not found, creating a new item in dynamo db with the key"
table.put_item(
Item={
'appname': appname,
'chef_max': True,
'arp_score': '110'
}
)
else:
print "partition key = "+str(appname)+" found, here is the item dict : "+str(response['Item'])
(ケースキーに存在する場合、私が見て、他のシナリオにしたいです)、いずれかの属性値が既に存在し、一致する場合。その場合、私はその推論で失敗して、属性を更新したいと思う。
botoにはどのようなコードがありますか?