1

Building on this answer: Complete scan of dynamoDb with boto3

What I would like to achieve is to also get the historical changes on each item. For example if item 1 has had three changes over time:

{
"item" : 1
"x" : "abc"
"time" : 1
} 
{
"item" : 1
"x" : "efg"
"time" : 2
} 
{
"item" : 1
"x" : "hij"
"time" : 3
} 

The scan will only give me the latest one, i.e.

{
"item" : 1
"x" : "hij"
"time" : 3
} 

Is there a way to get the previous two changes as well?

and_apo
  • 1,217
  • 3
  • 17
  • 41

1 Answers1

0

Is there a way to get the previous two changes as well?

Sadly, there is not unless you implement such a solution for that yourself. Probably you would have to use DynamoDB Streams to stream changes to a lambda function, and then store all historical values in some other database.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • Yeap that is what I am using now, but DynamoDB Streams doesn't offer that capability either as far as I can tell. It will only publish only from the time you deploy the Stream and onwards. – and_apo Aug 05 '21 at 13:33
  • @and_apo I wrote you need to develop fully **custom solution** for that yourself. DynamoDB streams would be small part of it. – Marcin Aug 05 '21 at 21:36
  • Sorry I don't get it. How would a custom solution work if the only way to query Dynamo(except DynamoDB streams) is the scan and the scan gives you only the latest change? – and_apo Aug 06 '21 at 09:10
  • @and_apo You would use DynamoDB streams to store and record any changes in your database. – Marcin Aug 06 '21 at 09:35
  • yes I get that :) but what about records and changes to those records before enabling DynamoDB streams? Are those stored somewhere that I can get or am I stuck with the latest update for each one? That is the essence of this question – and_apo Aug 06 '21 at 10:30
  • @and_apo No you cant any past records, unless you kept backups of your table. – Marcin Aug 06 '21 at 10:43