UpdateMetaEntity - 更新元数据实体

更新时间:
复制 MD 格式

更新元数据实体,支持更新创建的自定义类型对象或者扩展表对象(Database/Table/Column)

接口说明

需要购买 DataWorks 专业版及以上版本才能使用。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

POST  HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

Id

string

待更新实体 ID;实体名称、实体类型、父子关系由 ID 决定,不支持通过本接口修改

custom_entity-customer_api:api_001

Comment

string

注释

this is a comment

Attributes

object

实体属性,复杂值需要序列化为 JSON 字符串

[]

string

实体属性值

value

CustomAttributes

object

自定义属性值,key 为自定义属性标识,value 最多一个值;空列表表示删除该属性值

[]

array

自定义属性值的数组,当前仅支持单值数组

string

自定义属性值

张三

纯自定义实体

EntityType 使用 custom_entity-<name>。可更新内容如下:

字段支持情况说明
Comment支持更新实体注释
Attributes支持key 必须存在于对应 MetaEntityDef.AttributeDefs;未知 key 报错
CustomAttributes支持key 必须是适用于该实体类型的自定义属性定义

Attributes 规则

项目说明
更新语义patch 语义;只传入的 key 会被更新,其它已有属性保留
删除属性传入某个属性 key 且 value 为 null 时,会从实体 attributes 中删除该 key
必填属性如果删除或清空的是必填属性,会按合并后的结果校验并报错
ENUM 属性value 必须在 AttributeDef.AllowedValues
DATE 属性value 必须是毫秒时间戳
ARRAY/JSON 属性由于 OpenAPI 入参是字符串,通常需要传 JSON 字符串

示例:

{
  "Comment": "更新后的自定义实体",
  "Attributes": {
    "level": "L2",
    "profile": "{\"owner\":\"data_team\"}"
  },
  "CustomAttributes": {
    "biz_owner": ["data_team"]
  }
}

扩展表类型的 Database 对象

适用于 custom_<name>-database

Attributes key是否支持类型/写法说明
technicalMetadata.locationString更新 database 的存储位置,对应 ES 字段 location
parentMetaEntityId-父子关系不可更新,传入会报错
其它 key-共享实体更新白名单外的 key 会报错

扩展表类型 Table 对象

适用于 custom_<name>-table

Attributes key是否支持类型/写法说明
tableTypeString更新表类型;
partitionKeysJSON Array 字符串或 String传数组时会用逗号拼接后写入,例如 ["dt","hh"] 写成 dt,hh
technicalMetadata.ownerString更新 owner
technicalMetadata.locationString更新存储位置
technicalMetadata.compressedBoolean支持 truefalse
technicalMetadata.inputFormatString更新 InputFormat
technicalMetadata.outputFormatString更新 OutputFormat
technicalMetadata.serializationLibraryString更新 SerDe 类
technicalMetadata.parametersJSON Object 字符串或 String传 JSON Object 时会序列化为字符串写入 parameters
parentMetaEntityId-父 database 不可更新,传入会报错
columns-不能通过 UpdateMetaEntity 改字段列表;需要更新 column 实体本身
其它 key-共享实体更新白名单外的 key 会报错

示例:

{
  "Comment": "更新后的表说明",
  "Attributes": {
    "tableType": "VIEW",
    "partitionKeys": "[\"dt\"]",
    "technicalMetadata.location": "oss://bucket/ods/order_fact",
    "technicalMetadata.compressed": "true",
    "technicalMetadata.parameters": "{\"retention\":\"30\"}"
  },
  "CustomAttributes": {
    "biz_owner": ["data_team"]
  }
}

扩展表类型的 Column 对象

适用于 custom_<name>-column

Attributes key是否支持类型/写法说明
typeString更新字段类型
positionInteger更新字段位置
partitionKeyBoolean更新是否分区字段,对应 ES 字段 isPartitionKey
primaryKeyBoolean更新是否主键,对应 ES 字段 isPrimaryKey
foreignKeyBoolean更新是否外键,对应 ES 字段 isForeignKey
parentMetaEntityId-父 table 不可更新,传入会报错
其它 key-共享实体更新白名单外的 key 会报错

如果父表不存在、父表不属于当前租户,或者父表没有 inline columns,会报错。

示例:

{
  "Comment": "订单 ID",
  "Attributes": {
    "type": "BIGINT",
    "position": "1",
    "primaryKey": "true"
  },
  "CustomAttributes": {
    "security_level": ["P1"]
  }
}

不支持或容易误用的点

项目结论
修改实体名称不支持;名称来自 Id
修改 EntityType不支持;类型来自 Id
修改父实体不支持;attributes.parentMetaEntityId 会报错
修改字段列表不支持;attributes.columns 会报错
创建新字段不支持;扩展 table 的字段需要在创建 table 时通过 BatchCreateMetaEntitiesAttributes.columns 提供

返回参数

名称

类型

描述

示例值

object

Schema of Response

RequestId

string

Id of the request

AASFDFSDFG-DFSDF-DFSDFD-SDFSDF

Success

boolean

请求是否成功

true

Result

object

更新后的实体或写入结果

Id

string

实体 ID

custom_entity-customer_api:api_001

Success

boolean

是否成功

true

示例

正常返回示例

JSON格式

{
  "RequestId": "AASFDFSDFG-DFSDF-DFSDFD-SDFSDF",
  "Success": true,
  "Result": {
    "Id": "custom_entity-customer_api:api_001",
    "Success": true
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情