我实际上是不正确的.当我打算查询解释我的错误的索引时,我正在查询表.不过 Vikdor 的解决方案是有效的.
I was actually incorrect. I was querying the table when I meant to query an index which explains my error. Vikdor's solution is a valid one though.
原文:我在 DynamoDB 中有一个带有哈希范围键模式的表.我需要能够获取与特定哈希键关联的所有项目,但它似乎需要一个范围键条件.我的问题是我想要每个范围键,但没有通配符选项.截至目前,我的范围键是一个字符串,我能想到的唯一方法是查询所有大于或等于我可以使用的最小 ascii 字符的范围键,因为文档说它是根据 ascii 字符值排序的.
ORIGINAL: I have a table with a Hash-Range key schema in DynamoDB. I need to be able to get all items associated with a specific hash key but it seems to require a range key condition. My issue is I want EVERY range key but there is no wildcard option. As of right now my range key is a string and the only way I could think to do this is by querying all range keys greater or equal to the smallest ascii characters I can use since the documentation says it sorts based on ascii character values.
我研究过扫描,但似乎只会读取整个表格,这不是一个选项.
I looked into scanning but it appears that simply will read the entire table which is NOT an option.
有没有更好的方法来查询哈希键的所有值,或者任何人都可以确认使用带有 ascii 字符的方法是否有效?
Is there any better way to query for all values of a hash key or can anyone confirm that using the method with the ascii character will work?
但它似乎需要一个范围键条件.
but it seems to require a range key condition.
这听起来不是真的.
我使用 DynamoDBMapper 并使用 DynamoDBQueryExpression 查询具有给定 HashKey 的所有记录,如下所示:
I use DynamoDBMapper and use DynamoDBQueryExpression to query all the records with a given HashKey as follows:
DynamoDBQueryExpression<DomainObject> query =
new DynamoDBQueryExpression<DomainObject>();
DomainObject hashKeyValues = new DomainObject();
hashKeyValues.setHashKey(hashKeyValue);
query.setHashKeyValues(hashKeyValues);
// getMapper() returns a DynamoDBMapper object with the appropriate
// AmazonDynamoDBClient object.
List<DomainObject> results = getMapper().query(query);
HTH.
这篇关于使用 java sdk 从具有哈希范围模式的给定哈希键查询 DynamoDB 中的所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何检测 32 位 int 上的整数溢出?How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
return 语句之前的局部变量,这有关系吗?Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
如何将整数转换为整数?How to convert Integer to int?(如何将整数转换为整数?)
如何在给定范围内创建一个随机打乱数字的 intHow do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
java的行为不一致==Inconsistent behavior on java#39;s ==(java的行为不一致==)
为什么 Java 能够将 0xff000000 存储为 int?Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)