DynamoDB Scan with Simple Filter Expression

I have a Dynamo table ExchangeTrade with partition key id. I'd like to return a list of items from ExchangeTrade where the field userId is set to a selected string.

I have validated the following cli command:

aws dynamodb scan \
     --table-name ExchangeTrade \
     --filter-expression "userId = :userValue" \
     --expression-attribute-values '{":userValue":{"S":"userIdValue"}}'

However, I can't get this to work in retool. The scan will run but returns 0 items. When I run the cli command on local I get 6 items. Both the cli and retool have the same scanned count when run.

My config using the JSON editor:

{"TableName": "ExchangeTrade",
 "FilterExpression": "userId = :userValue",
"ExpressionAttributeValues": {":userValue":{"S":"userIdValue"}}}

My config using the visual editor:

I'm not sure what I've done wrong or how to proceed from here. Any help is appreciated, thanks in advance!

Hi @kevinpearl, Here's how you could set up this query with the GUI mode:

and with the JSON parameter:

I hope that helps!

1 Like

That worked, thanks! I was having trouble formatting the expression attribute values properly.

Just ran into this same issue; it is quite confusing that Retool expects the format

{":id": "1234"}

rather than the format that AWS shows throughout its docs:

{":id": {"S": "1234"}}

It wasn't immediately obvious that this was necessary by reading the DynamoDB docs here: DynamoDB Integration