Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching All Items with DynamoDBMapper

I want to get all of the records from a Dynamo DB table and have them mapped into an array of POJOs; The POJO is simple and already annotated.

DynamoDBMapper appears to be the object that will do a fetch to acquire the records and deserialize them into my POJOs. Perhaps using PaginatedScanList() to walk through the entire table.

Mapper's Scan() and PaginatedScanList() methods both require a DynamoDBScanExpression parameter. What DynamoDBScanExpression would be used to select all of the records in the table?

like image 837
Bex Avatar asked Jul 13 '15 18:07

Bex


People also ask

What is a DynamoDBMapper?

The DynamoDBMapper class is the entry point to Amazon DynamoDB. It provides access to a DynamoDB endpoint and enables you to access your data in various tables. It also enables you to perform various create, read, update, and delete (CRUD) operations on items, and run queries and scans against tables.

Can DynamoDBMapper query return null?

AWS DynamoDB Mapper query by GSI returns null for all non-key attributes.

What is PaginatedQueryList?

Class PaginatedQueryList<T>Implementation of the List interface that represents the results from a query in AWS DynamoDB. Paginated results are loaded on demand when the user executes an operation that requires them.

What is withScanIndexForward?

withScanIndexForward(Boolean scanIndexForward) Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false , the traversal is performed in descending order. QueryRequest. withSelect(Select select) The attributes to be returned in the result.


1 Answers

You can pass a new DynamoDBScanExpression() into the scan method.:

mapper.scan(MyObject.class, new DynamoDBScanExpression());

Or you could use the new Document API

like image 173
Chen Harel Avatar answered Sep 29 '22 08:09

Chen Harel