python - 无法使用 Python 创建 Azure 表

标签 python azure

我尝试使用 Azure 存储帐户创建,但出现以下错误。

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"}}}

我的代码在这里:

#!/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)

谁来帮助我。

最佳答案

Blob 存储 帐户仅支持 Blob。他们不支持表、队列和文件。因此,当您尝试创建表时,您会收到此错误。

您需要做的是创建一个标准存储帐户并在代码中使用它。请注意,您不应选择 ZRSPremium LRS 冗余级别,因为这些也不支持表。 LRSGRSRAGRS 冗余应该可以正常工作。

关于python - 无法使用 Python 创建 Azure 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42064344/

相关文章:

azure - 我可以实时查看 Windows Azure 日志而不将其写入存储吗?

azure - 如何在没有客户端 key 的情况下刷新企业应用程序的 Microsoft Graph API token ?

python - 使用 Python 说明读取 API 结果

python - 创建具有相同字段名称和不同文件类型的多部分表单数据

python - CherryPy - 静态文件的缓存

python - 如何让我的 Python 脚本永远运行?

php - Laravel:运行队列:在 Windows Azure Web App 上连续监听

python - 如何使用 Python 从 Azure Functions 中的辅助线程重定向日志

azure - 在 Azure 中选择哪种容器服务

python - 对 numpy 数组的每一行的唯一列索引进行采样