amazon-dynamodb - 本地 DynamoDB : How to view contents of a table?

标签 amazon-dynamodb

要列出本地安装的 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/

相关文章:

amazon-web-services - 从 DynamoDB 中的 startTime 和 endTime 字段查询时间范围?

node.js - AWS.DynamoDB.DocumentClient 未提供放置数据

amazon-web-services - 我们可以将 Map 的属性作为 DynamoDB 中的排序/范围键吗

amazon-web-services - 当多个客户端尝试同时读/写一个项目时,Redis 是原子的吗?

node.js - DynamoDB - 获取不起作用

docker - 使用无服务器和DynamoDB对Flask REST API进行Docker化

amazon-web-services - 用于 aws_api_gateway_integration 的 uri,用于类型 AWS(集成)到 DynamoDb

amazon-web-services - 查询表达式非法:在AWS Query的查询中未找到哈希键条件

javascript - 更新 DynamoDB 中的列表

amazon-web-services - 如何在 Node.js 上为 dynamodb getItem 在 JSON 中表达哈希 + 范围