2017-06-22 66 views
0

我试图从我的dynamodb表中获取所有数据,但无法获取查询/扫描的所有方法使用输入参数进行操作。所以我尝试让所有有主键大于0从dynamo db表中获取所有数据而不提供任何PK

 var table = Table.LoadTable(client,Utilities.Utility.EmployeeTable); 

     ScanFilter filter = new ScanFilter(); 
     filter.AddCondition("iemp_id", ScanOperator.GreaterThan, 0); 

     ScanOperationConfig config = new ScanOperationConfig() 
     { 
      Filter = filter, 
      // Optional parameters. 
      Select = SelectValues.SpecificAttributes, 
      AttributesToGet = new List<string> { "iemp_id", "demp_salary", "semp_name" } 
      //ConsistentRead = true 
     }; 

     Search search = table.Scan(config);` 

这里我得到search.Matches = 0,它应该从我的表中返回的数据行。

回答

0

你只有两个选择

1.Query:您需要提供分区键值(强制性)和可选范围键。 2.扫描:用分区键/范围键全面扫描表格。

在你的情况下,你将不得不做全表扫描。

DynamoDBQScanExpression scanExpression = new DynamoDBScanExpression(); scanExpression .withFilterExpression(filterexpression) .withExpressionAttributeValues(expression values);

相关问题