How to use wild card character * in dynamodb query operation?
You can use the Scan API to get all items in a DynamoDB table. If you only need the primary keys, you can use a ProjectionExpression="IdType"
to limit the amount of data you send back.
db_client.scan({table_name: "my_table_name"})
Chirag Sejpal
Updated on June 28, 2022Comments
-
Chirag Sejpal almost 2 years
I am using aws-ruby-sdk for accessing dynamodb. I want to use query operation and get all items. So I am using wildcard character * in expression_attribute_values. It doesn't work. However, if I specify a specific value, it works.
How do I use * ? Below is my code to query dynamodb:
db_client.query({ table_name: "my_table_name", key_condition_expression: "#idtype = :idType", expression_attribute_names: { "#idtype" => "IdType" }, expression_attribute_values: { ":idType" => "*", }, })
Also I am specifying * because I want all values. End result I want is only unique values in the primary key IdType but there seem to be no way to have unique constraint in dynamodb (not that I know of) so I am fetching all values and will have unique values from the result using my own code.
Any help would be appreciated.
PS: Primary Partition Key - IdType is a String