Yehudi
Yehudi

Reputation: 199

Get the dynamoDB's primary key list

I would like to extract the primary key of table to a list , but find no api to do that.

for example, as the amazon example thread table, I want to ask how to :

1) get the hash primary key list, in the amazon example thread table it would be an array of ["Amazon DynamoDB", "Amazon S3"]

2) with assigning the hash primary key to "Amazon DynamoDB", I want to get the range primary key list and it would be an array of ["Amazon DynamoDB Thread 1", "Amazon DynamoDB Thread 2"]

Upvotes: 12

Views: 33553

Answers (1)

Chen Harel
Chen Harel

Reputation: 10072

For 1 what you want is to run a Scan operation on a table. Scan Gets all the items of the list. Depends on the API you are using, you can get only the hash key or any attributes you want.

For 2 what you want is Query - which gets a hash attribute and returns all rows that have the hash attribute (can be more than one).

Overview - Query and Scan operations

Java mapper reference - Scan and Query

Upvotes: 5

Related Questions