本地DynamoDb:如何在本地dynamodb中查看表的内容

yas*_*ash 15 amazon-dynamodb

为了列出本地dynamoDB中的所有表,我知道命令,即

aws dynamodb list-tables --endpoint-url http://localhost:8000

但我想查看其中一个表中的内容.

让我知道命令是什么?

谢谢,斯里兰卡

not*_*est 25

转到" 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();
Run Code Online (Sandbox Code Playgroud)


was*_*ren 6

查看本地动态数据的一种方法是使用命令行。您可以例如做一张scan桌子。请注意,scan-command可能很重。

aws dynamodb scan \
    --table-name my_table_name 
    --endpoint-url http://localhost:8000
Run Code Online (Sandbox Code Playgroud)

--endpoint-url如果您使用的是DynamoDB的托管版本,请跳过该参数。

如果您不想执行- scan,则get-item-command可能是合适的。

命令:


tod*_*eny 5

我最近遇到的 dynamodb local 的免费可视化选项是dyanamodb-admin. 你可以在这里查看:https : //github.com/aaronshaf/dynamodb-admin


sta*_*ool 5

这个开源(dynamodb-manager)工具非常好。

它具有以下特点:

桌子

  • 添加表
  • 编辑表格
  • 删除表
  • 连接表
  • 添加索引(GSI 和 LSI)
  • 删除索引

物品

  • 新增项目
  • 编辑项目
  • 删除项目
  • 进口/出口物品

搜索(表或索引)

  • 扫描表
  • 查询表
  • 过滤条件

用法:

docker pull taydy/dynamodb-manager

docker run -t -p 8080:80 taydy/dynamodb-manager
Run Code Online (Sandbox Code Playgroud)

在浏览器中打开以下网址:

http://localhost:8080/ 或 http://127.0.0.1:8080/