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

如何在Apache Atlas中按typeName获取含全部属性的批量数据?

Apache Atlas批量查询缺失jdbcURL属性的解决方法

问题背景

创建Connection实体类型并导入包含jdbcURL属性的实体后,使用DSL批量查询仅返回name和description,jdbcURL属性缺失。

原因分析

Apache Atlas的DSL搜索接口默认仅返回**标记为可索引(isIndexable: true)**的属性。你定义jdbcURL时未设置isIndexable: true,因此该属性不会被默认返回。

解决方法

方法1:修改实体类型,为jdbcURL添加索引属性

更新Connection类型定义,将jdbcURL标记为可索引,后续批量查询会默认返回该属性:

  • 请求地址:http://localhost:21000/api/atlas/v2/types/typedefs(使用PUT请求更新类型)
  • 请求体:
{
    "entityDefs": [
        {
            "name": "Connection",
            "attributeDefs": [
                {
                    "name": "name",
                    "typeName": "string",
                    "isIndexable": true
                },
                {
                    "name": "description",
                    "typeName": "string",
                    "isOptional": true,
                    "isIndexable": true
                },
                {
                    "name": "jdbcURL",
                    "typeName": "string",
                    "isOptional": true,
                    "isIndexable": true
                }  
            ]
        }
    ]
}

更新类型后,重新导入实体数据或更新现有实体,即可在批量查询中获取jdbcURL属性。

方法2:查询时指定需要返回的属性

无需修改实体类型,直接在DSL查询中明确指定要返回的属性列表,推荐使用POST请求(比GET更灵活):

  • 请求地址:http://localhost:21000/api/atlas/v2/search/dsl(POST请求)
  • 请求体:
{
    "typeName": "Connection",
    "limit": 25,
    "offset": 0,
    "attributes": ["name", "description", "jdbcURL"]
}

该方式会强制返回指定的所有属性,不受索引设置限制。

方法3:通过GUID单独查询完整实体

如果已获取实体的guid,可通过单个实体查询接口获取完整属性:

  • 请求地址:http://localhost:21000/api/atlas/v2/entities/guid/16437ca0-c2fc-4019-9fc7-047f922d5d24(替换为实际GUID,GET请求)
  • 该接口会返回实体的全部属性信息,不受索引设置影响。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 22:12:33