Local DynamoDB: How to view the contents of a table?

To list all the tables in a locally installed instance of DynamoDB, I know that the command:

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

Now I want to view the contents of one of the tables. What is the team to do this?

+14
source share
4 answers

Go to " http: // localhost: 8000 / shell / " and execute the script below. Please change the table name according to your requirements.

When starting local DynamoDB, the above URL should be up and running.

 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(); 
+24
source

One way to view DynamodB local data is to use the command line. You can, for example, make a scan from a table. Note that scan -command can be heavy.

 aws dynamodb scan \ --table-name my_table_name --endpoint-url http://localhost:8000 

Skip the --endpoint-url option if you are using a managed version of DynamoDB.

If you do not want to do a scan , get-item -command might work.

Teams:

+5
source

you can not. in dynamodb you need to specify a hash key to get the result.

0
source

RazorSql does this when Dynamo-DB can be connected and queried as SQL with Dynamo-DB restrictions.

https://razorsql.com/docs/installation.html

It comes with a 30-day trial license.

Doc: https://razorsql.com/docs/dynamodb_sql_support.html#select_scan

0
source

All Articles