Reputation: 58
I need to retrieve all the RowKeys in a partition from an Azure Table.
I do not know the "type" of data stored, so retrieving all the entities and getting RowKey from there, does not seem to be possible.
I am not interested in the value, just the RowKeys.
Upvotes: 1
Views: 5415
Reputation: 3384
Using the Azure Storage client SDK :
// Create the filter
string filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "EnterPartitionKeyHere");
// Set projection to an empty list so you do not retrieve the
// unnecessary data. Faster retrieval and minimal payload.
TableQuery tableQuery =
new TableQuery().Where(filter).Select(new List<string>{});
//Execute the query
var result = table.ExecuteQuery(tableQuery);
Upvotes: 3
Reputation: 26266
If you are using .net framework to query the table, you can use DynamicTableEntity
to query entities of which type is unknown.
var tableQuery = new TableQuery<DynamicTableEntity>().Where(filters);
var tableResult = table.ExecuteQuery(tableQuery);
I wrote a simple Storage Table Browser to query from azure storage which you can find on github.
Upvotes: 3
Reputation: 136146
Azure Table Storage supports something called Query Projection
using which you can specify the attributes you wish to retrieve instead of retrieving all attributes. You can use that to retrieve just the RowKeys in a partition in a table.
Assuming you're using REST API, your query string would be:
?$filter=(PartitionKey eq 'Your PartitionKey')&$select=RowKey
You can read more about it here: http://msdn.microsoft.com/en-us/library/azure/dd894031.aspx.
Upvotes: 2