dynamodb 查询:我可以使用 beginswith 过滤器吗?
dynamodb query: Can I use beginswith filter?
我正在尝试查询 dynamodb table。当我使用 begins with 运算符时,出现以下错误。
{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
是全球二级索引
无论您查询的是 table 还是索引,唯一可以应用于哈希键属性的运算符是 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
我正在尝试查询 dynamodb table。当我使用 begins with 运算符时,出现以下错误。
{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
是全球二级索引
无论您查询的是 table 还是索引,唯一可以应用于哈希键属性的运算符是 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