Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure Tables, querying using Contains

I'm trying to implement a query for one of my Azure Tables, the query should retrieve all files that contain the input string.

I've tried using string.contains() but this isn't supported by Azure, I've also tried string.startswith() this also isn't supported.

What I'm wondering is if there is a way to do this in Azure Tables. I'm storing file information in the tables and the partition key is the virtual path of the item stored.

e.g. Images_Jpg_Image1.jpg would be a partition key for one of the files, i've used '_' because Azure won't allow '/' in partition keys.

I'd like to be able to compare the above partition key with

Ideally the following strings would return that partition key

Images_ Images_Jpg Jpg_ Image1.jpg

I have all the tables set up and all of the other queries, its just this one query that I can't figure out.

Thanks in advance for any help,

Matt

like image 491
Midimatt Avatar asked Apr 22 '11 20:04

Midimatt


People also ask

How do I check data on Azure table?

To view table data. In Cloud Explorer, open the Azure node, and then open the Storage node. Open the storage account node that you are interested in, and then open the Tables node to see a list of tables for the storage account. Open the shortcut menu for a table, and then select View Table.


1 Answers

Table Storage does support the CompareTo method which can be used like a StartsWith. But it still might not work for you based on the types of searching you're trying to do.

MyTable.Where(t => t.PartitionKey.CompareTo("image") >= 0).ToList();
like image 177
Vyrotek Avatar answered Sep 21 '22 16:09

Vyrotek