gpt4 book ai didi

c - 亚马逊 dynamoDb ValidationException

转载 作者:太空宇宙 更新时间:2023-11-04 00:02:27 25 4
gpt4 key购买 nike

我正在使用 C 中的 aws-dynamo 库执行以下 dynamoDB 查询参数。

{ "TableName": "table4", "KeyConditionExpression": "#yr = :yyyy and ts between :letter1 and :letter2", "ExpressionAttributeNames": { "#yr": "userid" }, "ExpressionAttributeValues": { ":yyyy": "abc", ":letter1": 1, ":letter2": 2 } }

但是我得到了错误

"__type":"com.amazon.coral.validate#ValidationException","message":"1 validation error detected: Value null at 'hashKeyValue' failed to satisfy constraint: Member must not be null"

这是我的表结构

 table4
{
"Table": {
"TableSizeBytes": 66,
"KeySchema": [
{
"AttributeName": "userid",
"KeyType": "HASH"
},
{
"AttributeName": "ts",
"KeyType": "RANGE"
}
],
"CreationDateTime": 1464617195.039,
"ItemCount": 3,
"AttributeDefinitions": [
{
"AttributeName": "ts",
"AttributeType": "N"
},
{
"AttributeName": "userid",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1,
"LastDecreaseDateTime": 1464683346.007,
"NumberOfDecreasesToday": 1
},
"TableStatus": "ACTIVE",
"TableName": "table4",
"TableArn": "arn:aws:dynamodb:us-east-1:456456456:table/table4"
}
}

最佳答案

分区键必须在 keyconditionexpression 中。请包含分区键并尝试。查询dynamodb时,partition key是必须的。扫描 dynamodb 时,分区键是可选的。这是 dynamodb 中查询与扫描之间的主要区别。

关于c - 亚马逊 dynamoDb ValidationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37529939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com