I am using 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));
});
Output :
{ AttributeDefinitions: [ { AttributeName: 'Id', AttributeType: 'S' } ],
TableName: 'acc_new',
KeySchema: [ { AttributeName: 'Id', KeyType: 'HASH' } ],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }
output consist of only key schemas(hash and range keys only) associated with the table, Not all the attributes. I want to fetch all attributes associated with data in the table.
Like:
{ AttributeName: 'AccountName', AttributeType: 'S' }
{ AttributeName: 'CreatedBy', AttributeType: 'S' }
...
...
Is there any way to get descriptions of a dynamoDb table with all of its data fields.
To read an item from a DynamoDB table, use the GetItem operation. You must provide the name of the table, along with the primary key of the item you want. The following AWS CLI example shows how to read an item from the ProductCatalog table. With GetItem , you must specify the entire primary key, not just part of it.
The Query operation in Amazon DynamoDB finds items based on primary key values. You must provide the name of the partition key attribute and a single value for that attribute. Query returns all items with that partition key value.
To export a DynamoDB table, you use the AWS Data Pipeline console to create a new pipeline. The pipeline launches an Amazon EMR cluster to perform the actual export. Amazon EMR reads the data from DynamoDB, and writes the data to an export file in an Amazon S3 bucket.
DynamoDB is a NoSQL database. While creating the table, it doesn't expect all the attributes to be defined in the table. Also, each item can have any number of non-key attributes. Only key attributes are common or mandatory across all the items in the table.
For the above mentioned reasons, the describe table can't provide all the attributes present in the table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With