Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dynamodb query remove response duplicates in columns specified in ProjectionExpression

Assume the following table, A is partition key, B is sort key:

A    B    C
a1   b1   c1
a1   b2   c1
a1   b3   c1
a1   b4   c2

If queried with KeyConditionExpression A=a1, ProjectionExpression C, return would be [c1, c1, c1, c2].

But I would like it to be [c1, c2], i.e. remove the duplicate c1.

How to do it?

like image 619
Zheng GONG Avatar asked Oct 19 '25 00:10

Zheng GONG


1 Answers

As far as I know this is currently not possible.

Also, compared to removing duplicates by yourself after you received the result, would be a smaller result set is (and therefore maybe a little faster transmission). Even if it was possible the query would consume the same throughput capacity because DynamoDB internally would also need to query all results and then remove duplicates.

like image 93
birnbaum Avatar answered Oct 21 '25 18:10

birnbaum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!