awslabs / dynein

DynamoDB CLI written in Rust.
https://github.com/awslabs/dynein
Apache License 2.0
364 stars 37 forks source link

Allow Full Attributes on Query or Scan #173

Closed eharik closed 1 year ago

eharik commented 1 year ago

It would be useful to be able to access the full attributes on a given query or scan. alternatively, the export command could allow for exporting to stdout (as opposed to requiring a file).

tmyoda commented 1 year ago

Hi, thank you for reaching out and for your feature request. To better understand your needs, we have a few questions for you.

  1. What kind of output format do you expect? Would you like the output to be listed like the get command, displayed one line per item, or in some other way?

  2. Accessing all attributes using query, scan, and export commands could potentially result in a large amount of items being printed to stdout. Could you please provide your use cases?

eharik commented 1 year ago

i think the same output as the export command (as opposed to tabulated as in query, or scan) would be useful. the use case is piping to other commands (typically jq) and extracting specific fields to add structure to the attributes blob. this is for data exploration, familiarity, manipulation, etc.

currently i'm using the export command and then redirecting from the file and then deleting the file. which is totally usable but a little clunky. adding a --stdout option would work. thought ideally one would be able to do the same thing with a query or scan after applying conditions/filters.

tmyoda commented 1 year ago

Thank you for providing the detailed use cases. Both scan and query commands have an --output option. If you want to pipe and extract specific fields using tools like jq, you could use an --output option as follows.

dy scan ... --output json | jq
dy query ... --output json | jq

Please let me know if it doesn't satisfy the use case.

eharik commented 1 year ago

this is exactly what i was looking for! i'll close the issue. thank you! potentially an update to the docs to include this option would be good?

tmyoda commented 1 year ago

I'm glad to hear that it's what you were looking for! Updating the docs to include this option is a good idea. We'll look into that. Thanks for bringing this to our attention.