node.js - Delete and create dynamoDB table -


using node.js try delete , create dynamodb table again. need delete records table , put new, think solution delete , recreate whole table. try code

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);                 }             })         }     }); 

and error resourceinuseexception: table exists:

you can use sdk's tablenotexists waiter ensure table has been deleted before calling createtable.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -