Amazon dynamodb 如何在AWS控制台中扫描带或状态的dynamo表?

Amazon dynamodb 如何在AWS控制台中扫描带或状态的dynamo表?,amazon-dynamodb,dynamodb-queries,Amazon Dynamodb,Dynamodb Queries,最近,我开始使用dynamo表,来自SQL背景,我对它的工作方式有点困惑 我想知道是否可以使用或条件扫描表?我所看到的是和条件,如下所示 i、 e.假设我的列名是id,我想得到多个id的结果,那么我该怎么做呢?我确信一定有办法,但我不知道。 在查询而不是扫描中,有一个类似于您所希望的或条件运算符 我们可以通过代码在过滤表达式中实现扫描 例如: ScanResult result = null; ScanRequest req = new ScanRequest();

最近,我开始使用
dynamo表
,来自
SQL
背景,我对它的工作方式有点困惑

我想知道是否可以使用
条件
扫描表
?我所看到的是
条件,如下所示

i、 e.假设我的列名是
id
,我想得到多个
id
的结果,那么我该怎么做呢?我确信一定有办法,但我不知道。


在查询而不是扫描中,有一个类似于您所希望的或条件运算符

我们可以通过代码在过滤表达式中实现扫描

例如:

ScanResult result = null;
            ScanRequest req = new ScanRequest();
            Map<String, AttributeValue> expressionAttributeValues = new HashMap<String, AttributeValue>();
            expressionAttributeValues.put(":dateStr", new AttributeValue().withS(date));
            expressionAttributeValues.put(":subDate1", new AttributeValue().withS(subDate1));
            req.setTableName(emailEventNotifsTableName);
            req.withFilterExpression("(begins_with(LastUpdated, :dateStr) or begins_with(LastUpdated, :subDate1))")
                    .withExpressionAttributeValues(expressionAttributeValues);
            int count = 0;
            dailyStatsTotalRows = new ArrayList<Map<String, AttributeValue>>();
            do {
//              ctx.getLogger().log("(getEmailEventNotifsTableStats)Iterating no:" + (++count));
                if (result != null) {
                    req.setExclusiveStartKey(result.getLastEvaluatedKey());
                }
                result = getAmazonDynamoDBClient().scan(req);
                List<Map<String, AttributeValue>> rows = result.getItems();
                for (Map<String, AttributeValue> row : rows) {
                    String lastUpdated = row.get("LastUpdated").getS();
                    ...
                }
            } while (result.getLastEvaluatedKey() != null);

ScanResult结果=null;
ScanRequest req=新的ScanRequest();
Map expressionAttributeValues=新HashMap();
expressionAttributeValues.put(“:dateStr”,新的AttributeValue().with(date));
expressionAttributeValues.put(“:subDate1”,新的AttributeValue().with(subDate1));
请求setTableName(emailEventNotifsTableName);
请求withFilterExpression(“(以(LastUpdated,:dateStr)开头或以(LastUpdated,:subDate1))开头”)
.带有expressionAttributeValues(expressionAttributeValues);
整数计数=0;
dailyStatsTotalRows=新ArrayList();
做{
//ctx.getLogger().log(((getEmailEventNotifsTableStats)迭代号:“+(++count));
如果(结果!=null){
req.setExclusiveStartKey(result.getLastEvaluatedKey());
}
结果=getAmazonDynamoDBClient().scan(req);
列表行=result.getItems();
用于(地图行:行){
字符串lastUpdated=row.get(“lastUpdated”).get();
...
}
}while(result.getLastEvaluatedKey()!=null);

当你说你想要得到多个id的结果时,你的意思是想要id等于id1或id2的结果吗?你能澄清一下吗?