gpt4 book ai didi

amazon-web-services - 动态数据库查询 : Can I use beginswith filter?

转载 作者:行者123 更新时间:2023-12-01 07:55:09 24 4
gpt4 key购买 nike

我正在尝试查询 dynamodb 表。当我使用以运算符开头时,出现以下错误。

{u'Message': u'All queries must have a condition on the hash key, and it must be of type EQ', u'__type': u'com.amazon.coral.validate#ValidationException'}


result_set = tb_places.query_2(
place_name__beginswith="ame",
)

这里 place_name是一个全局二级索引

最佳答案

无论您是查询表还是索引,唯一可以应用于哈希键属性的运算符是 EQ .或者,您可以使用 BEGINS_WITH在范围键上。

For a query on a table, you can have conditions only on the table primary key attributes. You must provide the hash key attribute name and value as an EQ condition. You can optionally provide a second condition, referring to the range key attribute.[...]

For a query on an index, you can have conditions only on the index key attributes. You must provide the index hash attribute name and value as an EQ condition. You can optionally provide a second condition, referring to the index key range attribute.



来源: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html

关于amazon-web-services - 动态数据库查询 : Can I use beginswith filter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29591959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com