I have some issues with setting up a connection between a Raspberry 3 / Sense Hat combination to Azure Storage Table Service, using Python under Raspberian. Following the tutorial at https://learn.microsoft.com/en-us/azure/storage/storage-python-how-to-use-table-storage, the code I use is (myaccountkey inserted, of course):
from sense_hat import SenseHat
from azure.storage.table import TableService
sense = SenseHat()
table_service = TableService(account_name='sensehat',
account_key=<myaccountkey>)
table_name = 'sensehatdata'
table_service.create_table(table_name, False)
The error traceback is:
Traceback (most recent call last):
File "/home/pi/senseHat2Azure.py", line 22, in <module>
table_service.create_table(table_name, False)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/table/tableservice.py", line 281, in create_table
self._perform_request(request)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/storageclient.py", line 171, in _perform_request
resp = self._filter(request)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/table/tableservice.py", line 667, in _perform_request_worker
return self._httpclient.perform_request(request)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/_http/httpclient.py", line 181, in perform_request
self.send_request_body(connection, request.body)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/_http/httpclient.py", line 143, in send_request_body
connection.send(request_body)
File "/usr/local/lib/python2.7/dist-packages/azure/storage/_http/requestsclient.py", line 81, in send
self.response = self.session.request(self.method, self.uri, data=request_body, headers=self.headers, timeout=self.timeout)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 407, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', gaierror(-2, 'Name or service not known'))
Some details to my storage account:
Many thanks for any ideas.
Reason you're getting this error is because of your storage account's redundancy type. Storage accounts with ZRS
redundancy type only supports blobs and not tables and queues.
From the blog post announcing this
:
As you can see, these options provide a continuum of durability and availability options. ZRS fits between LRS and GRS in terms of durability and price. ZRS stores 3 replicas of your data across 2 to 3 facilities. It is designed to keep all 3 replicas within in a single region, but may span across two regions. ZRS currently only supports block blobs. ZRS allows customers to store blob at a higher durability than a single facility can provide with LRS. ZRS accounts do not have metrics or logging capability enabled at this time.
Since it is not possible for you to change the redundancy type between ZRS and other (LRS, GRS, RAGRS), your only option would be to create a new storage account. Create a standard storage account and choose the redundancy type as one of the following: LRS, GRS or RAGRS. When you use that storage account, you will not see this error.