我執行以下使用AWS-發電機庫C.亞馬遜dynamoDb ValidationException
{ "TableName": "table4", "KeyConditionExpression": "#yr = :yyyy and ts between :letter1 and :letter2", "ExpressionAttributeNames": { "#yr": "userid" }, "ExpressionAttributeValues": { ":yyyy": "abc", ":letter1": 1, ":letter2": 2 } }
dynamoDB查詢參數,但我得到的錯誤
"__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中包含了分區鍵字段? – notionquest
partition key = userid,sortkey = ts –