LinqPad, Azure Table Storage Driver and continuation tokens – or ‘how to get more than 1000 results/run a query that runs for more than 5 seconds’

Mauricio Diaz Orlich made a LinqPad storage driver that lets you query Azure Table Storage as easily as any other data-source within LinqPad – this is invaluable when working with Azure as there aren’t any real alternatives when you just want to make an ad-hoc query or make multi-table queries.

However, there’s an issue – the driver doesn’t use continuation tokens internally so your query needs to both finish executing within the Azure Table Storage limit of 5 seconds and return fewer than 1000 results, otherwise you’ll be missing data and won’t necessarily notice.

I forked the source to see if I could patch in a way around it but in doing so found a much simpler solution – do exactly what you’d do in your .NET code and call the AsTableServiceQuery() extension method on your query before you materialise it.

For example:


Users
.Where(x => x.EmailAddress == "user@example.com")
.AsTableServiceQuery()
.ToList()

This query will now return as many results as exist (up to LinqPad’s seemingly unavoidable 10,000 record limit) and will execute for as long as it takes to actually return all results by way of continuation tokens.

Leave a Reply

Your email address will not be published. Required fields are marked *