How to get more than 1000 entities from an azure table storage query?

前端 未结 4 1469
暗喜
暗喜 2020-12-10 19:30

I have read that azure table storage queries give maximum of 1000 entities and we have to make use of continuation tokens to fetch the next set of entities. I am just lookin

相关标签:
4条回答
  • 2020-12-10 19:59

    There are lots of ways to query table storage, but the easiest way is to create a CloudTable object, create a TableQuery object, then call ExecuteQuery on the CloudTable object passing in the TableQuery object.

    The first result from http://www.bing.com/search?q=azure+table+storage+query&qs=n&form=QBRE&pq=azure+table+storage+query&sc=8-25&sp=-1&sk=&cvid=eb5a88d975df445ab665fbf5082fa7c8 will take you to http://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/ which shows examples of how to do this.

    0 讨论(0)
  • 2020-12-10 20:04

    It's a bit grotesque - and not a great long term solution - but I forked the Azure Storage Driver for Linqpad specifically to get all records from table storage.

    https://github.com/ryan1234/AzureStorageDriver

    Get it, build it and install it with Linqpad. An example query that goes against it in Linqpad:

    var logs = (from log in SBEmailWorkerRole.ToList()
                select new {
                    LogEntry = log.LogEntry,
                    CreateDate = log.Timestamp.ToLocalTime()
                }).ToList();
    
    logs.OrderByDescending(l => l.CreateDate).Dump("Logs");
    
    0 讨论(0)
  • 2020-12-10 20:07

    If my understanding of documents is correct, there is no way to do that.

    Please be aware that continuation tokens can be returned even when number of records < 1000. It is a good idea to always check for continuation tokens when executing queires.

    Also, why do you want to return more than 1000 records? what is the use case?

    0 讨论(0)
  • 2020-12-10 20:16

    Using the AsTableServiceQuery like so:

    var data = context.CreateQuery<SomeEntity>("table").AsTableServiceQuery<SomeEntity>().Execute();
    
    0 讨论(0)
提交回复
热议问题