user2121530
user2121530

Reputation: 107

Using group by in DynamoDB

For a project I have to use DynamoDB(aws) and python(with boto).

I have items with a date and I need to display the count grouped by date or by month.

Something like by date of the month [1/2: 5, 2/2: 10, 3/2: 7, 4/2: 30, 5/2: 25, ...] or by month of the year [January: 5, February: 10, March: 7, ...]

Upvotes: 0

Views: 3585

Answers (1)

Erben Mo
Erben Mo

Reputation: 3614

You can create 2 GSIs: 1 with date as hashKey, 1 with month as hashKey. Those GSIs will point you to the rows of that month / of that day.

Then you can just query the GSI, get all the rows of that month/day, and do the aggregation on your own.

Does that work for you?

Thanks!

Erben

Upvotes: 2

Related Questions