Browse through the questions and answers listed below or filter and sort to narrow down your results.
The method toJSONPretty() is undefined for the type Map<String,AttributeValue>
Hello I've a jsp with code (from https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ScanJavaDocumentAPI.html) :
...
```
<%@ page import="com.amazonaws.services.dynamodbv2.AmazonDynamoDB" %>
<%@ page import="com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder" %>
<%@ page import="com.amazonaws.services.dynamodbv2.document.DynamoDB" %>
<%@ page import="com.amazonaws.services.dynamodbv2.document.Item" %>
<%@ page import="com.amazonaws.services.dynamodbv2.document.ItemCollection" %>
<%@ page import="com.amazonaws.services.dynamodbv2.document.ScanOutcome" %>
<%@ page import="com.amazonaws.services.dynamodbv2.document.Table" %>
<%@ page import="com.amazonaws.services.dynamodbv2.model.AttributeValue" %>
<%@ page import="com.amazonaws.services.dynamodbv2.model.ScanRequest" %>
<%@ page import="com.amazonaws.services.dynamodbv2.model.ScanResult" %>
...
<%
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build();
DynamoDB dynamoDB = new DynamoDB(client);
String tableName = "TicketsWalletUsersDev";
// Table table = dynamoDB.getTable(tableName);
Map<String, AttributeValue> lastKeyEvaluated = null;
do {
ScanRequest scanRequest = new ScanRequest()
.withTableName(tableName)
.withLimit(10)
.withExclusiveStartKey(lastKeyEvaluated);
ScanResult result = client.scan(scanRequest);
for (Map<String, AttributeValue> item : result.getItems()){
System.out.println(item.toJSONPretty());
}
lastKeyEvaluated = result.getLastEvaluatedKey();
} while (lastKeyEvaluated != null);
%>
```
It gives the error:
The method toJSONPretty() is undefined for the type Map<String,AttributeValue>
I want the string containing the true json and not the string returned from item.toString() that is :
{addresses={M: {mobile+75@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1583142338893,}, verified={BOOL: true}},}, federico+11@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1581332986414,}, verified={BOOL: true}},}, federico+signup3@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1581330211793,}, verified={BOOL: true}},}, federico+33@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1581330013122,}, verified={BOOL: true}},}, mobile@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1583162677615,}, verified={BOOL: true}},}, federico+12@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1581333042026,}, verified={BOOL: true}},}, federico+2@nearit.com={M: {requestId={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6_1581332941950,}, verified={BOOL: true}},}},}, created={S: 2020-02-05T10:40:17.887Z,}, userName={S: 909b1963-0ed4-4ac1-9b71-846239ed5bf6,}}
Thanks!
Accepted AnswerAmazon DynamoDB
1
answers
0
votes
30
views
asked 13 days ago
0
answers
0
votes
5
views
asked 25 days ago
How to use LastEvaluatedKey in ExecuteStatement request?
According to the documentation for [ExecuteStatement](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ExecuteStatement.html):
> If `LastEvaluatedKey` is present in the response, you need to paginate the result set.
How can I use `LastEvaluatedKey` if `ExecuteStatement` request has no `ExclusiveStartKey` parameter as `Scan` and `Query`.
I cannot use `NextToken` because it is not returned when `Limit` is specified.
Accepted AnswerAmazon DynamoDB
1
answers
0
votes
17
views
asked a month ago
DynamoDB how does partitioning work when sort key begins to be included
My question about DynamoDB is about this: https://aws.amazon.com/blogs/database/choosing-the-right-dynamodb-partition-key/
Where it says: “DynamoDB splits partitions by sort key if the collection size grows bigger than 10 GB.”
Does that mean it will use the sort key for partitioning? As in PK+SK will be used to calculate the hash? Or just that it will be sorted by SK, so once a partition fills, the next partition will pick up where the other one left off? But it’s still only the PK used for calculating the hash
I’m wondering if the cardinality of my partition key is determined by PK or PK+SK.
If it’s the latter, then an operation like “Delete all items where PK=X”, would not have as big of a hot key / hot partition concern, because the SK should distribute the operation across many partitions. But if all items with the same PK are bundled up together in one partition (or a couple) then it will definitely be a problem.
Accepted AnswerAmazon DynamoDB
1
answers
0
votes
9
views
asked 2 months ago
Is DynamoDB DeleteItem read-consistent?
Dear Experts,
DynamoDB GetItem operations can be read-consistent or not. But there isn't a corresponding setting for DeleteItem. So are DeleteItem operations consistent?
I.e. if one connection does a PutItem, and then another connection does a DeleteItem with the same key, is it guaranteed that the just-put item is actually deleted?
In my case I'm using SetReturnValues(ALL_OLD) to both read and delete an item, if that makes any difference.
Thanks, Phil.
Accepted AnswerAmazon DynamoDB
2
answers
0
votes
14
views
asked 3 months ago