spoof3r
spoof3r

Reputation: 627

C# azure table query returning 501 not implemented

I'm using Azure Table Storage and have a table I am trying to query where the row key ends with some value I am interested in filtering by. Here is my code:

var query = table.CreateQuery<DynamicTableEntity>().Where(o => o.PartitionKey == somePartitionKey && o.RowKey.EndsWith(string.Format("_{0}", aclId))).AsTableQuery();

I then perform a ExecuteQuerySegmentedAsync but for some reason that throws the following exception:

A first chance exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in mscorlib.dll

Additional information: The remote server returned an error: (501) Not Implemented.

Any ideas why this is? Do I have a problem with my code/query causing it to fail? At any rate I really need an efficient way to retrieve all the records in a partition where the row key ends with some value.

Upvotes: 0

Views: 2459

Answers (2)

PinoyDev
PinoyDev

Reputation: 1047

Also remember Blob storage does not have access to table services only general purpose ones. So if you run into this and you know that you have setup a blob storage resource then it's not going to work.

Upvotes: 0

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

The reason you're getting this error is because you're trying to perform an unsupported operation. As of today, Azure Table Service doesn't support EndsWith query operator. For the list of supported LINQ operators, please see this link: https://msdn.microsoft.com/en-us/library/azure/dd135725.aspx.

In your scenario, you will need to download the entities on the client side first and then apply EndsWith operator on those entities.

Upvotes: 3

Related Questions