amazon-dynamodb - 如何查询 DynamoDb 中的对象列表(使用 CLI)
问题描述
下面是我使用扫描表时 DynamoDb 中的表结构
aws dynamodb scan --table-name "hotel" --endpoint-url http://localhost:8088
{
"Count": 2,
"Items": [
{
"dc": {
"N": "0"
},
"sw": {
"L": [
{
"N": "1"
}
]
}
},
{
"dc": {
"N": "0"
},
"sw": {
"L":[]
},
}
],
"ScannedCount": 2,
"ConsumedCapacity": null
}
现在我想查询表 where sw: []
。我正在使用以下查询来检索结果。
aws dynamodb query --table-name "hotel" --key-conditions file:////tables/key1.json --endpoint-url http://localhost:8088 where
key1.json
{
"sw":{
"ComparisonOperator":"EQ",
"AttributeValueList": [ {"L":[]} ]
}
}
但我收到以下错误
An error occurred (ValidationException) when calling the Query operation: Query condition missed key schema element
请建议我如何查询表以检索结果。
解决方案
您构建表格的方式很难通过其字段查询数组。尝试将每个项目保存为一行。
推荐阅读
- ssl - 找到 SSL 对称加密的算法
- python - Shopify Webhooks Hmac Python 验证失败
- node.js - 请求的资源上不存在“Access-Control-Allow-Origin”标头。使用 next-connect 时出现 Next.js CORS 错误
- python - 在 django 中按日期过滤
- python - SL被击中后自动信号忽略
- python - 使用 Payever 的 PayPal 购物车请求
- c++ - 形成隐式转换序列的要求是矛盾的
- reactjs - 使用 next.js 检查数据是否存在
- google-cloud-platform - 将网站转移到 Google Cloud 托管;我们可以在转移过程中使用子域吗?
- reactjs - 在 React 的 get Request 中使用 formData 参数获取数据