Bhavik Shah
Bhavik Shah

Reputation: 95

Get oldest n rows from Table in Azure Table Storage using Python

I am trying to get the first(oldest) n rows of data from a table in Azure Table Storage - but am unable to find any documentation that allows doing so via Python. I use an integer-based hash value as my PartitionKey and by default, the table is sorted by PartitionKey. However, I need to fetch the oldest n rows. Is there any way or feasible hack I can use to do this?

Upvotes: 0

Views: 493

Answers (1)

Stanley Gong
Stanley Gong

Reputation: 12153

Unfortunately there is no solution. Server side sorting is not supported in table storage. If you want to sort by timestamp, you have to set the PartitionKey's value to the timestamp, and then the query result will be sorted by timestamp in the reverse order.

Upvotes: 1

Related Questions