This is two part question for first part
Updating the value of DynamoDB table with boto3 implemented lambda function
now what i am trying to achieve is having dynamic value to update
def lambda_handler(event, context):
param = event['queryStringParameters']['employeID']
name = event['queryStringParameters']['employeName']
dynamodb = boto3.resource('dynamodb', region_name="us-east-1")
table = dynamodb.Table('api_demo_employe')
column = [cloumn1,cloumn2......]
for i in range(0,len(column):
query = 'SET {} = :f'.format(column[i])
response = table.update_item(
Key = {
'employeID' : param
},
ExpressionAttributeValues = {
':f': name
},
UpdateExpression = query
)
I am getting an error
"errorMessage": "An error occurred (ValidationException) when calling the UpdateItem operation: One or more parameter values were invalid: Cannot update attribute employeID. This attribute is part of the key",
I know the issue is with how i am handling UpdateExpression
Could any one help me put with this one?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…