Fulfillment of a request to the data storage register in Azure

This may be somewhat related to this SO question. How to execute a case-sensitive LINQ query in Azure? . However, I am using Storage Client 3.0, not linq and TableStorageContext queries in this question.

I have a table storage object called Account that has a string property for an email address. The email property is not a section key or a row key.

I want to search for an object with an appropriate email address, not case sensitive, so the search for " bob@test.com " returns " Bob@Test.com ", etc.

My code looks something like this:

TableQuery<Account> rangeQuery = new TableQuery<Account>().Where( TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "account"), TableOperators.And, TableQuery.GenerateFilterCondition("Email", QueryComparisons.Equal, email))); var results = accountsTable.ExecuteQuery(rangeQuery).ToList(); 

Is there a way to execute a case-insensitive query using the tableQuery class, or is there a different approach? Should I just focus on data processing and ensure that all data is forcibly consistent?

+7
azure azure-storage azure-table-storage
source share
2 answers

To answer a case-insensitive search question , this cannot be done using Windows Azure Table Storage .

One way is that you suggested, for example, doing data processing and storing everything in lower or upper case.

Another approach would be to download the data on the client side, and then perform a case-sensitive search on the client. The second approach may be feasible for small data sets, but would not be practical if the data set is much larger.

+5
source share

Searching for anything that is not the leftmost part of the section + line will lead to a table scan.

One approach would be to store the email in a lower or upper case in another table so that it can be searched without scanning the table.

In your example, say

 Partition key = test.com Row key = bob 

will work well enough and give you many query options.

+3
source share

All Articles