首页 > 解决方案 > AWS CLI DynamoDB 路径:

问题描述

如果我以这种方式扫描,效果很好:

 aws dynamodb scan --table-name my_table --select "COUNT" --filter-expression "attribute_type(destination.amount, :v_sub)" --expression-attribute-values file://expression-attribute-values.json

destination.amount正确的路径在哪里:

在此处输入图像描述

但现在我想从这样的路径中读取:

在此处输入图像描述

我该如何阅读sender.custom:codigoCorporativa?我不能这样做:

 aws dynamodb scan --table-name my_table --select "COUNT" --filter-expression "attribute_type(sender.custom:codigoCorporativa, :v_sub)" --expression-attribute-values file://expression-attribute-values.json

否则我会收到此错误:

An error occurred (ValidationException) when calling the Scan operation: Invalid FilterExpression: Syntax error; token: ":codigoCorporativa", near: "custom:codigoCorporativa,"

我尝试使用:

sender.custom:codigoCorporativa
"sender.custom:codigoCorporativa"
\"sender.custom:codigoCorporativa\"
sender.'custom:codigoCorporativa'

任何想法?

编辑:我刚刚在AWS DynamoDB 文档中读到特殊字符喜欢#并且:应该避免,但我现在需要扫描一个名称:

标签: aws-cli

解决方案


好吧,我不得不使用占位符:

aws dynamodb scan --table-name my_table --select "COUNT" --filter-expression 
"attribute_type(#code, :v_sub)" --expression-attribute-values file://expression-attribute-values.json --expression- 
attribute-names '{"#code":"sender.custom:codigoCorporativa"}'

推荐阅读