dynamodb查询:我可以使用beginwith filter吗?

har*_*ohn 2 boto amazon-web-services amazon-dynamodb

我正在尝试查询dynamodb表.当我使用begin with运算符时,我收到以下错误.

{u'Message':u'所有查询必须在哈希键上有条件,并且必须是EQ'类型',''__ type':u'com.amazon.coral.validate#ValidationException'}

result_set = tb_places.query_2(
    place_name__beginswith="ame",
)
Run Code Online (Sandbox Code Playgroud)

place_name是全球二级指数

bsd*_*bsd 9

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

对于表的查询,您只能对表主键属性具有条件.您必须提供散列键属性名称和值作为EQ条件.您可以选择提供第二个条件,参考范围键属性.[...]

对于索引的查询,您只能对索引键属性有条件.您必须提供索引哈希属性名称和值作为EQ条件.您可以选择提供第二个条件,参考索引键范围属性.

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