我正在尝试对表中的键值进行扫描,它在查询中工作正常,但在扫描中却无法正常工作。我想念什么吗?
def get_items_from_id_list(id_list, table_name, key_name):
#setup resource
table = get_dynamo_table(table_name, dynamodb_region_name)
# scan
condition_expression = Attr(key_name).is_in(id_list)
result = table.scan(FilterExpression=condition_expression)
# query for 1
query_expression = Key(key_name).eq(id_list[0])
result2 = table.query(KeyConditionExpression=query_expression)
# !! result contains 0 items
# !! result2 contains 1 item
if not result.get('Count'):
return []
out = result['Items']
del out['aws:rep:updatetime']
return out