我有以下代码:
func updateStatusInDynamoDB(svc dynamodbiface.DynamoDBAPI, tableName, bucketName, objectKey string) error {
_, err := svc.UpdateItem(&dynamodb.UpdateItemInput{
TableName: aws.String(tableName),
Key: map[string]*dynamodb.AttributeValue{
"data": &dynamodb.AttributeValue{
M: map[string]*dynamodb.AttributeValue{
"original": &dynamodb.AttributeValue{S: aws.String(fmt.Sprintf("s3://%s/%s", bucketName, objectKey))},
},
},
},
UpdateExpression: aws.String("set job_status = :s"),
ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
":s": &dynamodb.AttributeValue{S: aws.String(PROCESSED)},
},
})
return err
}
我在dynamoDB中的输入如下:
{
"data": {
"original": "s3://api-prod-uploadbucket-***/uploads/www.domain.tld/provider/archive.csv"
},
"job_status": "UPLOADED",
"provider": "provider",
"timestamp": "2019-03-18 15:52:22.075817398 +0000 UTC m=+0.079862916",
"uuid": "7c571c46-22a5-4137-acdf-9d6bcdf06abb",
"website": "www.domain.tld"
}
但是我得到这个错误:
ValidationException: The provided key element does not match the schema
当我仅通过data.original
时,选择记录的正确方法是什么?
非常感谢任何建议