You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Azure Synapse在Azure存储资源管理器中查询表存储?

直接查询Azure表存储的几种方法

方法一:使用Azure CLI

先确保已安装Azure CLI并完成登录(执行az login),然后通过以下命令执行查询:

# 查询指定表的所有实体
az storage entity query --account-name <你的存储账户名> --account-key <你的存储账户密钥> --table-name <目标表名>

# 带过滤条件查询(示例:PartitionKey等于"user-group-1")
az storage entity query --account-name <你的存储账户名> --account-key <你的存储账户密钥> --table-name <目标表名> --filter "PartitionKey eq 'user-group-1'"

# 指定返回的属性
az storage entity query --account-name <你的存储账户名> --account-key <你的存储账户密钥> --table-name <目标表名> --select "PartitionKey,RowKey,UserEmail"

方法二:使用.NET SDK

先安装NuGet包Azure.Data.Tables,再编写代码实现查询:

using Azure.Data.Tables;

var connectionString = "你的存储账户连接字符串";
var tableName = "目标表名";

// 初始化TableClient
var tableClient = new TableClient(connectionString, tableName);

// 查询所有实体
var allEntities = tableClient.Query<TableEntity>();
foreach (var entity in allEntities)
{
    Console.WriteLine($"分区键: {entity.PartitionKey}, 行键: {entity.RowKey}");
}

// 带过滤条件查询
var filteredEntities = tableClient.Query<TableEntity>(filter: "PartitionKey eq 'user-group-1' and RowKey gt '20240501'");

// 指定返回属性
var selectedEntities = tableClient.Query<TableEntity>(select: new[] { "PartitionKey", "UserEmail" });

方法三:使用Python SDK

先安装包azure-data-tables,再通过代码查询:

from azure.data.tables import TableClient

connection_string = "你的存储账户连接字符串"
table_name = "目标表名"

with TableClient.from_connection_string(connection_string, table_name) as table_client:
    # 查询所有实体
    all_entities = table_client.list_entities()
    for entity in all_entities:
        print(f"分区键: {entity['PartitionKey']}, 行键: {entity['RowKey']}")
    
    # 带过滤条件查询
    filtered_entities = table_client.query_entities(filter="PartitionKey eq 'user-group-1'")
    
    # 指定返回属性
    selected_entities = table_client.query_entities(select=["PartitionKey", "UserEmail"])

方法四:通过Azure Portal可视化查询

  1. 登录Azure Portal,找到目标存储账户
  2. 在左侧菜单“数据存储”分类下选择“表”
  3. 点击要查询的表,进入表详情页
  4. 点击顶部的“查询编辑器”,输入OData格式的过滤条件(比如PartitionKey eq 'user-group-1'),点击“运行”即可查看结果

内容的提问来源于stack exchange,提问作者Joel Carvalho

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 05:50:27