Reputation: 93
Is there a way to return all the values from an attribute (column) in a DynamoDB Table? And does this operation actually have the same computational costs as a ScanAll
operation?
I have a large enough table, which I don't intend to return all of of its values, but need only some the values from one of the attributes. I am afraid that if I do a ScanAll
operation and then reduce the data, or Query
the operational costs will be the same. The workflow as I imagine goes, First, reading all the records receive a blob object and then cutting it to get the attribute in question.
Upvotes: 2
Views: 5142
Reputation: 20042
According to docs: GetItem returns all of the item's attributes. You can use a projection expression to return only some of the attributes.
Having said that, Projection Expression
is a string that identifies the attributes that you want. To retrieve a single attribute, specify its name. For multiple attributes, the names must be comma-separated.
aws dynamodb get-item \
--table-name ProductCatalog \
--key file://key.json \
--projection-expression "Description, RelatedItems[0], ProductReviews.FiveStar"
The arguments for --key
are stored in the key.json
file.
Full docs on that are here.
Upvotes: 1