I'm using the AWS CLI to make a dynamoDB query that includes key-condition-expression
and expression-attribute-names
and I keep getting invalid errors:
Invalid type for parameter ExpressionAttributeNames.:taskName, value: OrderedDict([(u'S', u'taskOne')]), type: <class 'collections.OrderedDict'>, valid types: <type 'basestring'>
Invalid type for parameter ExpressionAttributeNames.#status, value: OrderedDict([(u'S', u'status')]), type: <class 'collections.OrderedDict'>, valid types: <type 'basestring'>
Invalid type for parameter ExpressionAttributeNames.:status, value: OrderedDict([(u'S', u'success')]), type: <class 'collections.OrderedDict'>, valid types: <type 'basestring'>
I've looked at previous questions such as dynamodb-get-item-boto3-parameter-validation-failed and invalid-type-parameter-class-str-valid-types-class-dict but I'm not seeing what I'm doing wrong.
Dynamo calls require the attribute datatype, which I have included, but I think that's what is causing the error. Removing the datatype causes another expected error.
Heres my call:
aws dynamodb query \
--table-name myTable \
--key-condition-expression "taskName = :taskName AND #status = :status" \
--expression-attribute-names '{":taskName":{"S":"taskOne"},"#status":{"S":"status"},":status":{"S":"success"}}'
UPDATE:
When I remove the datatype: "S"
, I get this error:
Error parsing parameter '--expression-attribute-names': Invalid JSON: No JSON object could be decoded