Windows Azure Tables Queries Using Contains

I am trying to execute a query for one of my Azure Tables, the query should retrieve all the files containing the input string.

I tried using string.contains (), but it is not supported by Azure, I also tried string.startswith (), it is also not supported.

I am wondering if there is a way to do this in Azure Tables. I store information about files in tables, and the section key is the virtual path of the saved item.

eg. Images_Jpg_Image1.jpg there will be a partition key for one of the files, I used '_' because Azure will not allow '/' in partition keys.

I would like to compare the previous section with

Ideally, the following lines return this section key

Images_ Images_Jpg Jpg_ Image1.jpg

I have all the tables configured and all the other queries, this is just one query that I cannot understand.

Thanks in advance for your help,

Matt

+6
source share
3 answers

Table storage supports the CompareTo method, which can be used as StartsWith. But it may still not work for you based on the types of searches you are trying to do.

MyTable.Where(t => t.PartitionKey.CompareTo("image") >= 0).ToList(); 
+3
source

I had similar problems with looking for Azure table distortions by name and ensuring that the results were random.

What I ended up with is actually loading the data I need from the Azure tables into a memory collection that is stored in the requested collection. Then I was able to use Linq for objects to query and get the desired results.

Not an elegant approach, but if the data collection is not huge and relational, the size of the object in memory will be relatively soft in sympathy with how much memory the VM has. Performance was also much faster.

You can also try and just have the key and the partition / partition data that you are trying to query in memory, run the query, iterate over the partition keys and strings, and return the results. Not sure if this will help solve your question, but I am throwing it away as a possible approach.

Good luck

John

+2
source

I found a query to the Azure Table repository using LINQPad very conveniently. Check out Jason Gully's blog for more information and samples.

-1
source

Source: https://habr.com/ru/post/886503/


All Articles