-1

I'm having an error when I run a command to extract data to a csv file, using the AWS CLI with jq.

Command:
aws dynamodb scan --table-name MyTable --select ALL_ATTRIBUTES --page-size 500 --max-items 100000 --output json --profile production | jq -r '.Items' | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ].S])[] | @csv' > export.my-table.csv

Error:
'charmap' codec can't encode characters in position 1-3: character maps to <undefined> parse error: Unfinished JSON term at EOF at line 5097, column 21

  • Does this help -> https://stackoverflow.com/questions/33357821/export-a-dynamodb-table-as-csv-through-aws-cli-without-using-pipeline – Borislav Stoilov Nov 29 '22 at 15:06
  • It looks like the json file is not valid. Maybe the transmission is incomplete? Have you had a look at line 5097? – jpseng Nov 29 '22 at 15:26

1 Answers1

1

I believe that is a query that I wrote previously that does not work on nested attributes. You will have to modify it accordingly.

Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31