更新时间:2024-07-05 GMT+08:00
分享

无血缘关系表查询

功能介绍

无血缘关系表查询,请求参数type_names、classification、type_names、connection_names、query需至少指定一个。

调用方法

请参见如何调用API

URI

POST /v3/{project_id}/lineage/search/unrelated/table

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参见项目ID和账号ID

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token,使用Token认证时必选。通过调用IAM服务的“获取用户Token”接口获取响应消息头中X-Subject-Token的值。

workspace

String

工作空间ID,获取方法请参见实例ID和工作空间ID

表3 请求Body参数

参数

是否必选

参数类型

描述

attributes

Object

属性。

classifications

Array of strings

分类。

connection_names

Array of strings

数据连接。

exclude_classifications

Boolean

是否排除分类。

exclude_security_levels

Boolean

是否排除密级。

exclude_tags

Boolean

是否排除标签。

include_classification_attributes

Boolean

包含分类属性。

include_sub_classifications

Boolean

包含子分类。

limit

Integer

分页参数,每页限制数量,默认查询所有。

offset

Integer

分页参数,偏移量,默认查询所有。

order

String

排序方式。

query

String

查询参数。

search_name_and_description

Boolean

是否按名称和描述搜索。

security_levels

Array of strings

安全密级列表。

term_names

Array of strings

标签列表。

type_names

Array of strings

类型列表。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

attributes

AttributeSearchResult object

属性信息。

classification

String

分类。

count

Integer

结果总量。

entities

Array of AtlasEntityHeader objects

资产信息。

full_text_result

Array of AtlasFullTextResult objects

全文结果。

query_text

String

查询内容。

query_type

String

查询类型,取值范围DSL、FULL_TEXT、GREMLIN、BASIC、ATTRIBUTE、RELATIONSHIP、ADVANCED。

referred_entities

Object

Map(String, AtlasEntityHeader),key:guid,value:资产信息AtlasEntityHeader。

scroll_id

String

滚动条id。

search_parameters

Object

参数。

type

String

类型。

表5 AttributeSearchResult

参数

参数类型

描述

name

Array of strings

名称列表。

values

Array of objects

值列表。

表6 AtlasEntityHeader

参数

参数类型

描述

type_name

String

类型名称。

guid

String

资产guid。

name

String

名称。

display_text

String

展示。

status

String

状态。

classification_names

Array of strings

分类名称列表。

classifications

Array of AtlasClassificationInfo objects

分类信息。

meaning_names

Array of strings

标签名称列表。

meanings

Array of TermAssignmentHeader objects

关联任务。

children

Object

实体map Map(String, AtlasEntityHeader)。key:guid,value:资产信息。

attributes

Object

实体map Map(String, Object)。key:属性名称,value:属性值。

表7 AtlasFullTextResult

参数

参数类型

描述

entity

AtlasEntityHeader object

资产信息。

score

Number

数值。

表8 AtlasClassificationInfo

参数

参数类型

描述

entity_guid

String

资产guid。

propagate

Boolean

是否传播。

validity_periods

Array of TimeBoundary objects

时间信息。

type_name

String

类型名称。

attributes

Object

实体map Map(String, Object),key:属性名称,value:属性值。

表9 TimeBoundary

参数

参数类型

描述

start_time

String

开始时间。

end_time

String

结束时间。

time_zone

String

时区。

表10 TermAssignmentHeader

参数

参数类型

描述

confidence

Integer

信任id。

steward

String

管理员。

source

String

来源。

status

String

状态 枚举值:DISCOVERED、PROPOSED、IMPORTED、VALIDATED、DEPRECATED、OBSOLETE、OTHER。

create_user

String

创建人。

expression

String

表达式。

display_text

String

展示信息。

term_guid

String

标签guid。

relation_guid

String

关联guid。

状态码: 400

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 401

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 403

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 404

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

{
  "attributes" : {
    "database" : [ "database" ],
    "classifications" : [ ],
    "connection_names" : [ ],
    "exclude_classifications" : false,
    "exclude_security_levels" : false,
    "exclude_tags" : false,
    "include_classification_attributes" : false,
    "include_sub_classifications" : false,
    "limit" : 10,
    "offset" : 0,
    "order" : "incr",
    "query" : "wk_02",
    "search_name_and_description" : true,
    "security_levels" : [ ],
    "term_names" : [ ],
    "type_names" : [ ]
  }
}

响应示例

状态码: 200

OK。

{
  "attributes" : null,
  "classification" : null,
  "count" : 78,
  "entities" : [ {
    "attributes" : {
      "securityLevel" : null,
      "owner" : "DA_test",
      "comments" : null,
      "createTime" : 1674961143000,
      "qualifiedName" : "wk.hive_02@hive.192.168.0.96-mrs_3x_autotest_do_not_del.0833a5737480d53b2f25c010dc1a7b88-workspace -b88c445407b24283aa949f9833a38fd8",
      "connectionQName" : "hive@192.168.0.96-mrs_3x_autotest_do_not_del.0833a5737480d53b2f25c010dc1a7b88-workspace -b88c445407b24283aa949f9833a38fd8",
      "name" : "hive_02",
      "description" : null,
      "connectionType" : "hive"
    },
    "children" : null,
    "classification_names" : [ ],
    "classifications" : null,
    "display_text" : null,
    "guid" : "9915ee1e-3803-4f4d-86b2-ee5dfadc0d46",
    "meaning_names" : [ ],
    "meanings" : [ ],
    "name" : null,
    "status" : "ACTIVE",
    "type_name" : "hive_table"
  } ],
  "full_text_result" : null,
  "query_text" : "",
  "query_type" : "ADVANCED",
  "referred_entities" : null,
  "scroll_id" : null,
  "search_parameters" : null,
  "type" : null
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.dataartsstudio.v1.region.DataArtsStudioRegion;
import com.huaweicloud.sdk.dataartsstudio.v1.*;
import com.huaweicloud.sdk.dataartsstudio.v1.model.*;


public class ShowUnrelatedTableSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        DataArtsStudioClient client = DataArtsStudioClient.newBuilder()
                .withCredential(auth)
                .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowUnrelatedTableRequest request = new ShowUnrelatedTableRequest();
        SearchParametersExt body = new SearchParametersExt();
        request.withBody(body);
        try {
            ShowUnrelatedTableResponse response = client.showUnrelatedTable(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdataartsstudio.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = DataArtsStudioClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowUnrelatedTableRequest()
        request.body = SearchParametersExt(
        )
        response = client.show_unrelated_table(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dataartsstudio.NewDataArtsStudioClient(
        dataartsstudio.DataArtsStudioClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowUnrelatedTableRequest{}
	request.Body = &model.SearchParametersExt{
	}
	response, err := client.ShowUnrelatedTable(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK。

400

BadRequest。

401

Unauthorized。

403

Forbidden。

404

Not Found。

相关文档