amazon-web-services - 对 DynamoDB 中的 GSI 进行批量查询?
问题描述
是否可以在 GSI 上使用 DynamoDBMapper 同时对多个哈希键值创建单个查询?例如,如果我尝试使用 GSI 获取表 Table 中的所有相关记录,我将遍历我的所有哈希键值并对每个哈希键值进行单独查询。
即目前我正在做
for (String s : listOfStrings) {
Attribute thing = new Attribute();
thing.setSomeField(s);
DynamoDBQueryExpression<Attribute> queryExpression =
new DynamoDBQueryExpression<Attribute>()
.withHashKeyValues(thing)
.withIndexName("example-GSI")
.withConsistentRead(false);
}
但我想在批处理调用而不是 for 循环中完成所有操作。
我检查了 DynamoDBMapper 文档,似乎没有,但我只是想知道这里是否有人对这种情况有任何好的解决方案。
解决方案
不,DynamoDB 不支持。当我需要对多个哈希键运行查询时,我使用循环并一次查询一个。如果您愿意,也可以发送并行请求。
推荐阅读
- javascript - 如何在 cola.js 中修复其侧父组持有者的节点?
- c++ - 如何在 for 循环之外将值添加到数组而不将它们重置为 0
- python - 从单词列表中排除字符串中的字母列表
- reactjs - 使用react连接socket io,无法获取数据
- firebase - 从 sqflite 获取数据并将其发送到 firebase
- javascript - 作为道具传播和传递物体不起作用
- opentap-proj - 从代码加载测试计划后无法检测到配置文件
- c++ - 混淆数据库事务的异常控制
- azure - Azure 搜索服务文档字段与索引字段
- python - 为什么“pip install json”显示版本错误