【发布时间】:2019-01-29 04:29:59
【问题描述】:
我正在使用 Node.js
var AWS = require('aws-sdk');
AWS.config.update({
region: "region",
endpoint: "https://dynamodb.region.amazonaws.com"
});
var dynamodb = new AWS.DynamoDB();
var params = {
TableName: "acc_new"
};
dynamodb.describeTable(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(JSON.stringify(data));
});
输出:
{ AttributeDefinitions: [ { AttributeName: 'Id', AttributeType: 'S' } ],
TableName: 'acc_new',
KeySchema: [ { AttributeName: 'Id', KeyType: 'HASH' } ],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }
输出仅包含与表关联的键模式(仅哈希和范围键),而不是所有属性。我想获取与表中数据关联的所有属性。
喜欢:
{ AttributeName: 'AccountName', AttributeType: 'S' }
{ AttributeName: 'CreatedBy', AttributeType: 'S' }
...
...
有没有办法获取 dynamoDb 表及其所有数据字段的描述。
【问题讨论】:
-
不,没有。请参阅this 答案。
标签: node.js amazon-web-services amazon-dynamodb