要列出本地安装的 DynamoDB 实例中的所有表,我知道命令是:
aws dynamodb list-tables --endpoint-url http://localhost:8000
现在,我想查看其中一个表的内容。执行此操作的命令是什么?
最佳答案
转到“http://localhost:8000/shell/ ”并执行以下脚本。请根据您的要求更改表名称。
当您运行本地 DynamoDB 时,上述 URL 应该已启动并正在运行。
var dynamodb = new AWS.DynamoDB({
region: 'us-east-1',
endpoint: "http://localhost:8000"
});
var tableName = "TESTTABLE";
var params = {
TableName: tableName,
Select: "ALL_ATTRIBUTES"
};
function doScan(response) {
if (response.error) ppJson(response.error); // an error occurred
else {
ppJson(response.data); // successful response
// More data. Keep calling scan.
if ('LastEvaluatedKey' in response.data) {
response.request.params.ExclusiveStartKey = response.data.LastEvaluatedKey;
dynamodb.scan(response.request.params)
.on('complete', doScan)
.send();
}
}
}
console.log("Starting a Scan of the table");
dynamodb.scan(params)
.on('complete', doScan)
.send();
关于amazon-dynamodb - 本地 DynamoDB : How to view contents of a table?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37317458/