如何使用where条件扫描dynamodb表

时间:2018-06-24 10:36:34

标签: amazon-web-services amazon-dynamodb

我正在此get_item中获取数据。如何在EventName ='newevent'和'RekognitionId':{'S':match ['Face'] ['FaceId']

的扫描查询中获取此数据
 face = dynamodb.get_item(
                                    TableName='athlete_collection',
                                    Key={'RekognitionId': {'S': match['Face']['FaceId']}
                                        # ,'EventName': {'S' : 'celeb'}
                                         }
                                )

1 个答案:

答案 0 :(得分:1)

您可以按以下方式使用FilterExpression

Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
expressionAttributeValues.put(":val", new AttributeValue().withN("0")); 

ScanRequest scanRequest = new ScanRequest()
    .withTableName("ProductCatalog")
    .withFilterExpression("Price < :val")
    .withExpressionAttributeValues(expressionAttributeValues);


ScanResult result = client.scan(scanRequest);
for (Map<String, AttributeValue> item : result.getItems()) {
    printItem(item);
}

有关更多详细信息,请参见Filter Expressions for Scan