I want to get only the first rows of every partition in Azure Tables. I can get all the data and then use the solution in this answer on that result. What I am asking is "Can I do that on Azure side without getting all that unnecessary results?"
7
-
Do you know the PartitionKey values of the table that you wish to query?Gaurav Mantri– Gaurav Mantri2016-08-15 13:00:58 +00:00Commented Aug 15, 2016 at 13:00
-
@GauravMantri I will write a condition based on partition key. That will filter out many records. After that part, what i do not want is getting, say 50, entities per partition key as I only need the first one (ordered by row key) for each partition key.Nuri Tasdemir– Nuri Tasdemir2016-08-15 13:05:31 +00:00Commented Aug 15, 2016 at 13:05
-
@GauravMantri I do not have any information on row key. I just know that I want the one with min row key for each partition key (for the partition keys satisfying the condition).Nuri Tasdemir– Nuri Tasdemir2016-08-15 13:08:41 +00:00Commented Aug 15, 2016 at 13:08
-
@GauravMantri Currently I am eliminating the rows other than the MIN row on the server side(c#) instead of AzureTables sideNuri Tasdemir– Nuri Tasdemir2016-08-15 13:11:05 +00:00Commented Aug 15, 2016 at 13:11
-
I edited the question. Filtering on partition key is not related to what I am asking.Nuri Tasdemir– Nuri Tasdemir2016-08-15 13:24:47 +00:00Commented Aug 15, 2016 at 13:24
|
Show 2 more comments
1 Answer
Simple answer to your question is that without knowing the PartitionKey in advance, such operation is not possible from the Azure Table side. If you know the PartitionKey values, you can query on that value (RowKey is not required) and then get single result by specifying $top=1 (Take(1) in LINQ) as one of the querystring parameter.
2 Comments
Aran Mulholland
And how about a sample of the code to do just that?
Aran Mulholland
Back here again, and I would still like a code sample... :)