Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I query keys starting with underscores with the AWS Dynamo cli?

Tags:

I have a key starting with underscore and don't know how to query it

aws dynamodb query \
    --table-name mytable \
    --key-condition-expression '_mykey=:xxx' \
    --expression-attribute-values '{ ":xxx": {"S": "somevalue"}}'

An error occurred (ValidationException) when calling the Query operation: Invalid KeyConditionExpression: Syntax error; token: "_", near: "_mykey"

Can I escape it somehow? I tried "/_mykey" and "\_mykey" but doesn't work.

like image 523
red888 Avatar asked Apr 08 '20 14:04

red888


1 Answers

this might be the most awful user experience ive ever had with a tool

aws dynamodb query \
    --table-name mytable \
    --projection-expression "#aaa" \
    --expression-attribute-names '{ "#aaa": "_id" }' \
    --key-condition-expression "#aaa=:bbb" \
    --expression-attribute-values '{ ":bbb": {"S": "somevalue"}}'
like image 119
red888 Avatar answered Sep 28 '22 03:09

red888