CreateLineageRelationship

Updated at:

Registers a data lineage relationship in DataWorks Data Map. You can use this operation to establish lineage relationships between metadata entities managed by DataWorks, including table-to-table, column-to-column, table-to-column, and dataset-to-table scenarios. You can also establish lineage relationships between managed entities and custom entity objects registered by users. This operation is compatible with non-managed custom objects, but this approach is no longer recommended. Before calling this operation, make sure that the managed entities involved in the lineage registration already exist on the DataWorks platform.

Operation description

  1. DataWorks Professional Edition or a higher edition is required.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:CreateLineageRelationship

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

SrcEntity LineageEntity

No

The source entity.

DstEntity LineageEntity

No

The destination entity.

Task LineageTask

No

The task information.

Entity object (SrcEntity / DstEntity)

Describes the source and destination of a lineage relationship. You can register lineage relationships between the following types of entities:

Entity typePre-registration requiredHow to obtain the IDDescription
DataWorks collected tableNoCall ListTables or GetTable and use the Id in the response.Applicable to tables already collected by the DataWorks platform or extended tables registered by users.
DataWorks collected columnNoCall ListColumns or GetColumn and use the Id in the response.Columns corresponding to collected tables.
DatasetNo, if the dataset already exists. To create a dataset, call CreateDataset first.Call CreateDataset, ListDatasets, or GetDataset and use the Id in the response.Applicable to DataWorks dataset entities.
Dataset versionNo, if the version already exists. To create a version, call CreateDatasetVersion first.Call CreateDatasetVersion, ListDatasetVersions, or GetDatasetVersion and use the Id in the response.Applicable to specific versions of a dataset.
User-registered custom entity objectYesCall CreateMetaEntityDef to create a custom entity definition, then call BatchCreateMetaEntities to create entity objects, and use the Id in the response.Applicable to custom entities that need to be managed and queried in DataWorks.
Non-managed custom object (not recommended)NoThe caller specifies an Id prefixed with custom- in the format custom-{Type}:{Identifier}.Compatible with legacy usage but no longer recommended. For external reports, third-party system objects, and other custom objects, register them as DataWorks custom entity objects first and then register the lineage.

Additional notes:

  • For tables, columns, datasets, and dataset versions already collected by DataWorks, we recommend that you avoid manually constructing the Id and instead use the Id returned by the corresponding Get or List API.

  • For custom objects, we recommend that you use the user-registered custom entity object approach. Complete the entity definition and entity object registration first:

    1. Call CreateMetaEntityDef to create a custom entity definition.

    2. Call BatchCreateMetaEntities to create specific entity objects.

    3. Use the entity Id returned by BatchCreateMetaEntities as SrcEntity.Id or DstEntity.Id.

  • For non-managed custom objects, you do not need to call CreateMetaEntityDef or BatchCreateMetaEntities. Simply pass an entity Id prefixed with custom- and specify the Name. This approach is mainly for backward compatibility with legacy scenarios and is no longer recommended. For new integrations, use the registered custom entity object approach for easier querying, management, and custom attribute extension.

  • SrcEntity.Attributes and DstEntity.Attributes represent extended attributes of the entity endpoints. Place attributes of the lineage relationship itself in Task.Attributes.

Task information (Task)

Describes the job or task that produces the lineage relationship.

ParameterTypeRequiredDescription
IdStringNoThe unique identifier of the task. We recommend that you pass a stable value for idempotent registration, querying, and deletion. Only letters, digits, and underscores are supported. Maximum length: 64 characters.
TypeStringYesThe task type. Must start with custom-. Only letters, digits, underscores, and hyphens are supported. Maximum length: 64 characters.
AttributesMap<String,String>NoThe task attributes. A maximum of 20 attributes are supported. Complex values must be serialized as JSON strings. • Key: the attribute name (letters, digits, and underscores, ≤ 64 characters). • Value: the attribute value (≤ 128 characters).

Request examples.

DataWorks collected table and custom entity object

{
  "SrcEntity": {
    "Id": "custom_entity-customer_api:api_001",
    "Name": "api_001"
  },
  "DstEntity": {
    "Id": "mysql-table:rm-xxx::demo_db::demo_table",
    "Name": "demo_table"
  },
  "Task": {
    "Id": "api_to_table_001",
    "Type": "custom-lineage-task",
    "Attributes": {
      "scene": "api_to_table",
      "owner": "zhangsan"
    }
  }
}

Non-managed custom object and DataWorks collected table

Note

This approach is mainly for backward compatibility with legacy usage and is no longer recommended. For new integrations, register custom entity objects by using CreateMetaEntityDef and BatchCreateMetaEntities first, and then use the returned entity Id to register the lineage.

{
  "SrcEntity": {
    "Id": "custom-report:report_001",
    "Name": "report_001"
  },
  "DstEntity": {
    "Id": "maxcompute-table:::demo_project:default:demo_table",
    "Name": "demo_table"
  },
  "Task": {
    "Id": "report_to_table_001",
    "Type": "custom-lineage-task",
    "Attributes": {
      "scene": "report_to_table"
    }
  }
}

Response elements

Element

Type

Description

Example

object

The response.

RequestId

string

The request ID. A unique identifier for the request.

C99E2BE6-9DEA-5C2E-8F51-1DDCFEADE490

Success

boolean

Indicates whether the request was successful.

true

Id

string

The lineage relationship ID.

4as3dasf654a

Examples

Success response

JSON format

{
  "RequestId": "C99E2BE6-9DEA-5C2E-8F51-1DDCFEADE490",
  "Success": true,
  "Id": "4as3dasf654a"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.