मैं DynamoDB जावास्क्रिप्ट खोल का उपयोग करते हुए एक सरल तालिका बनाने के लिए कोशिश कर रहा हूँ और मैं इस अपवाद हो रही है:कुंजी स्कीमा विशेषता में परिभाषित विशेषताओं की संख्या से मेल खाना चाहिए में विशेषताओं की संख्या परिभाषाएँ
{
"message": "The number of attributes in key schema must match the number of attributes defined in attribute definitions.",
"code": "ValidationException",
"time": "2015-06-16T10:24:23.319Z",
"statusCode": 400,
"retryable": false
}
नीचे है तालिका मैं बनाने की कोशिश कर रहा हूं:
var params = {
TableName: 'table_name',
KeySchema: [
{
AttributeName: 'hash_key_attribute_name',
KeyType: 'HASH',
},
],
AttributeDefinitions: [
{
AttributeName: 'hash_key_attribute_name',
AttributeType: 'S',
},
{
AttributeName: 'attribute_name_1',
AttributeType: 'S',
}
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1,
},
};
dynamodb.createTable(params, function(err, data) {
if (err) print(err);
else print(data);
});
हालांकि अगर मैं कुंजीशेमा में दूसरी विशेषता जोड़ता हूं, तो यह ठीक काम करता है। कार्य तालिका के नीचे:
var params = {
TableName: 'table_name',
KeySchema: [
{
AttributeName: 'hash_key_attribute_name',
KeyType: 'HASH',
},
{
AttributeName: 'attribute_name_1',
KeyType: 'RANGE',
}
],
AttributeDefinitions: [
{
AttributeName: 'hash_key_attribute_name',
AttributeType: 'S',
},
{
AttributeName: 'attribute_name_1',
AttributeType: 'S',
}
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1,
},
};
dynamodb.createTable(params, function(err, data) {
if (err) print(err);
else print(data);
});
मैं श्रेणी को मुख्य स्कीमा में जोड़ना नहीं चाहता हूं। इसे कैसे ठीक किया जाये, कोई विचार?
क्या यह केवल डायनेमो डीब्लोकल के खिलाफ होता है? क्या होता है जब आप वास्तविक सेवा के खिलाफ एक ही चीज़ करने की कोशिश करते हैं? – mkobit
मेरे पास अभी तक एक एडब्ल्यूएस खाता नहीं है, इसलिए वास्तविक सेवा के खिलाफ इसका परीक्षण नहीं किया जा सका। मैं डायनेमो डीबी स्थानीय (dynamodb_local_2015-04-27_1.0) का नवीनतम संस्करण उपयोग कर रहा हूं। – NAbbas
मैं dynamodb_local_2016-04-19 – Chris