4

I am trying to query an Azure storage table to get all rows to turn into a table on a web site, however I cannot get the entries from the table, I get the same error every time "azure.core.exceptions.HttpResponseError: The requested operation is not implemented on the specified resource."

For code I am following the examples here and it is not working as expected.

from azure.data.tables import TableServiceClient
from azure.core.credentials import AzureNamedKeyCredential

def read_storage_table():
    credential = AzureNamedKeyCredential(os.environ["AZ_STORAGE_ACCOUNT"], os.environ["AZ_STORAGE_KEY"])
    service = TableServiceClient(endpoint=os.environ["AZ_STORAGE_ENDPOINT"], credential=credential)
    client = service.get_table_client(table_name=os.environ["AZ_STORAGE_TABLE"])
    entities = client.query_entities(query_filter="PartitionKey eq 'tasksSeattle'")
    client.close()
    service.close()

    return entities

Then calling the function.

table = read_storage_table()
for record in table:
    for key in record.keys():
        print("Key: {}, Value: {}".format(key, record[key]))

And that returns:

Traceback (most recent call last):
  File "C:\Program Files\Python310\Lib\site-packages\azure\data\tables\_models.py", line 363, in _get_next_cb
    return self._command(
  File "C:\Program Files\Python310\Lib\site-packages\azure\data\tables\_generated\operations\_table_operations.py", line 386, in query_entities
    raise HttpResponseError(response=response, model=error) 
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Not Implemented'
Content: {"odata.error":{"code":"NotImplemented","message":{"lang":"en-US","value":"The requested operation is not implemented on the specified resource.\nRequestId:cd29feda-1002-006b-679c-3d39e8000000\nTime:2022-03-22T03:27:00.5993216Z"}}}

Using a similar function I am able to write to the table. But even trying entities = client.list_entities() I get the same error. I'm at a loss.

2
  • Please share the values for your environment variables. Replace sensitive information with dummy text before sharing. Commented Mar 22, 2022 at 7:22
  • 2
    I found the issue, it was with my storage endpoint, it was https://<accountname>.table.core.windows.net/<table>, which worked fine to add data to but I had to change it to just https://<accountname>.table.core.windows.net to query. Commented Mar 23, 2022 at 0:52

1 Answer 1

6

KrunkFu thank you for identifying and sharing the solution here. Posting the same into answer section to help other community members.

replacing https://<accountname>.table.core.windows.net/<table>, with https://<accountname>.table.core.windows.net to the query solved the issue

Sign up to request clarification or add additional context in comments.

1 Comment

Please just vote to close as 'typo or could not be reproduced.' It was just an error on the OP's part, and they fixed it. No need to convert their comment into an answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.