msc
msc

Reputation: 34628

Failed to create Azure table using Python

I'm trying to create a table using Azure storage account, but I got following error.

Traceback (most recent call last):
  File "./table.py", line 10, in <module>
    table_service.create_table('tasktable')
  File "/usr/local/lib/python2.7/dist-packages/azure/storage/table/tableservice.py", line 525, in create_table
    _dont_fail_on_exist(ex)
  File "/usr/local/lib/python2.7/dist-packages/azure/storage/_error.py", line 81, in _dont_fail_on_exist
    raise error
azure.common.AzureHttpError: Not Implemented
{"odata.error":{"code":"NotImplemented","message":{"lang":"en-US","value":"The requested operation is not implemented on the specified resource.\nRequestId:xxxxxxxxxxxxxxx\nTime:2017-02-06T09:23:30.6719100Z"}}}

My code is here:

#!/usr/bin/env python

from azure.storage.table import TableService, TablePermissions #Entity
from azure.storage.blob import BlockBlobService

table_service = TableService(account_name='myAccount', account_key='myKey')

table_service.create_table('tasktable')

task = Entity()
task.PartitionKey = 'tasksSeattle'
task.RowKey = '2'
task.description = 'Wash the car'
task.priority = 100

table_service.insert_entity('tasktable', task)

Someone help me.

Upvotes: 4

Views: 343

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136266

Blob Storage accounts only support blobs. They don't support tables, queues & files. Because of this, when you try to create a table you're getting this error.

What you need to do is create a Standard storage account and use that in your code. Please note that you should not choose ZRS or Premium LRS redundancy level there as these also don't support tables. LRS, GRS and RAGRS redundancy should work just fine.

Upvotes: 4

Related Questions