通过python API获取Windows Azure存储表名称

通过python API获取Windows Azure存储表名称,python,azure,azure-storage,azure-table-storage,Python,Azure,Azure Storage,Azure Table Storage,我正在尝试获取我的Windows Azure存储帐户的所有表的名称,以便使用table_服务删除它们。delete_table'tasktable' 不幸的是,我没有在WindowsAzure中找到任何内容。我只找到了解释我想做什么的和,但它不是python中的 有没有办法使用python获取所有名称表?您可以调用query\u tables来枚举存储帐户中的各种表: from azure.storage import TableService table_service = TableSer

我正在尝试获取我的Windows Azure存储帐户的所有表的名称,以便使用table_服务删除它们。delete_table'tasktable'

不幸的是,我没有在WindowsAzure中找到任何内容。我只找到了解释我想做什么的和,但它不是python中的

有没有办法使用python获取所有名称表?

您可以调用query\u tables来枚举存储帐户中的各种表:

from azure.storage import TableService

table_service = TableService(account_name='name', account_key='key')
alltables = table_service.query_tables()
for table in alltables:
    print table.name
您可以在中查看查询表的定义。您可以调用查询表来枚举存储帐户中的各种表:

from azure.storage import TableService

table_service = TableService(account_name='name', account_key='key')
alltables = table_service.query_tables()
for table in alltables:
    print table.name

您可以在

中看到查询表的定义。该服务已更新为列表表,但仍能正常工作。David Makogon的上述回答是有效的,但查询表端点现在是表列表

from azure.cosmosdb.table.tableservice import TableService

table_service = TableService(account_name='name', account_key='key')
alltables = table_service.table_list()
for table in alltables:
    print table.name

该服务已更新为列出_表,但仍能正常工作。David Makogon的上述回答是有效的,但查询表端点现在是表列表

from azure.cosmosdb.table.tableservice import TableService

table_service = TableService(account_name='name', account_key='key')
alltables = table_service.table_list()
for table in alltables:
    print table.name

Azure Table Storage在预览版中有一个新的python库,可通过pip进行安装。要安装,请使用以下pip命令

pip install azure-data-tables
此SDK能够针对Tables或Cosmos端点(尽管存在)

要查询所有表并随后删除,您可以使用如下列表\表方法:

从azure.data.tables导入TableServiceClient table_service_client=TableServiceClient.from_connection_stringmy_conn_str 对于表\服务\客户端列表\表中的表: 表\服务\客户端。删除\表\表。表\名称 您还可以使用query_tables方法和筛选器仅删除表的子集:

... table_filter=TableName ne'tableToKeep' 对于表\服务\客户端中的表。查询\表筛选器=表\筛选器: 表\服务\客户端。删除\表\表。表\名称
仅供参考,我是Azure SDK for Python团队的Microsoft员工,Azure Table Storage在预览版中有一个新的Python库,可通过pip进行安装。要安装,请使用以下pip命令

pip install azure-data-tables
此SDK能够针对Tables或Cosmos端点(尽管存在)

要查询所有表并随后删除,您可以使用如下列表\表方法:

从azure.data.tables导入TableServiceClient table_service_client=TableServiceClient.from_connection_stringmy_conn_str 对于表\服务\客户端列表\表中的表: 表\服务\客户端。删除\表\表。表\名称 您还可以使用query_tables方法和筛选器仅删除表的子集:

... table_filter=TableName ne'tableToKeep' 对于表\服务\客户端中的表。查询\表筛选器=表\筛选器: 表\服务\客户端。删除\表\表。表\名称 仅供参考,我是Azure SDK for Python团队的Microsoft员工