1

I'm trying to find a way to create a list in c# of only the partition keys in a dynamodb table. There are no duplicates in the partition keys (so no sort key) and I am not interested in returning any of the other information in the row. Is there a way I can query for the partition keys and drop them into a List?

I have found plenty of answers that return the entire table information, but I only need the partition keys. This question (DynamoDB : List all partition keys) states that it can be done but did not provide a code sample and I am struggling to figure it out on my own.

1 Answers1

0

You need to do a Scan and provide AttributesToGet or ProjectionExpression

string tableName = "Thread";
Table ThreadTable = Table.LoadTable(client, tableName);

ScanOperationConfig config = new ScanOperationConfig()
{
  AttributesToGet = new List<string> { "pk" } 
};

Search search = ThreadTable.Scan(config);
Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31