DynamoDB to CSV is not as easy as it sounds – but can be crunched in a couple of commands.  During the Komodo blockchain scaling stuff we’re doing, in a simple scaled down run of about 1k tx/s we ended up with 40k items in a DynamoDB table.  To convert to csv, I did these commands using jq

aws dynamodb scan --table-name kmd-blocknotify-blackjok3r-1-v0 > result.json

 jq ".Items[] | [ .ac.S, .height.N, .totaltx.N, .size.N, .time.N, .mempoolMB.N, .mempooltx.N] | @csv" result.json  | sed 's/"//g' | sed 's/\\//g' > result.csv

Then to sort by a particular column

cat result.csv | sort --field-separator=',' --key=5 > sorted.csv

Easy to handle in a spreadsheet now 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *