使用 node.js 我尝试再次删除并创建 dynamoDB 表。我需要从表中删除所有记录并添加新记录,所以我认为删除并重新创建整个表是一个很好的解决方案。我尝试使用此代码
dynamo.deleteTable({
TableName: tableName
}, function(err, data){
if (err) {
console.log(err);
}
else {
dynamo.createTable({
TableName: tableName,
KeySchema: [{
AttributeName: "id",
KeyType: "HASH"
}],
AttributeDefinitions: [{
AttributeName: "id",
AttributeType: "S"
}],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
}
}, function(err){
if (err) {
console.log(err);
}
else {
// putNewData(data, callback);
}
})
}
});
我得到错误 ResourceInUseException:表已经存在: