Brett Brett - 5 months ago 53
reST (reStructuredText) Question

Filter Azure Table Storage by RowKey and StartsWith using the Python SDK

I have seen that Azure Table Storage supports querying records by a partial

(in addition to the
) (C# example here).

However, I can't find anything related to this in the actual docs on filtering query results (here).

I am trying to using the Python Azure-Storage SDK to query a subset of
combinations where the
starts with a certain string. I have the code (which works, but does not do correct filtering any row keys):

from import TableService
table_service = TableService(account_name=ACCOUNT_NAME, account_key=ACCOUNT_KEY)
entities = table_service.query_entities('mystoragetable', filter='PartitionKey eq mypartitionkey"', num_results=10)

However, I can't figure out the syntax for also adding a partial (
) constraint to the filter.

Has anyone had any experience with filtering Azure Table Storage queries by partial
I am at a loss here; however, it seems to be possible via the
code in the example above.

If there are any extra docs about how to do this via a REST call, I can probably translate that into the Python usage.


Assuming your RowKey values contains words and you only want to filter the words starting with a and b, this is what you would add to your query:

(RowKey ge 'a' and RowKey lt 'c') ==> (RowKey >= 'a' && RowKey < 'c')

So your code would be something like:

entities = table_service.query_entities('mystoragetable', filter="PartitionKey eq 'mypartitionkey' and RowKey ge '<starts with substring>'", num_results=10)