
# 获取数据集详情 - ShowDatasetDetail
#### 功能介绍
获取数据集详情。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-dataartsinsight/abcd.html)。
#### URI
GET /v1/{project_id}/datasets/{dataset_id}/metadata
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                            |
|:---|:---|:---|:---|
| dataset_id | 是    | String | **参数解释：** 数据集ID。 **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                                                                                    |
| project_id | 是    | String | **参数解释：** 项目ID。获取方法请参见[获取项目ID](https://support.huaweicloud.com/api-dataartsinsight/dataartsinsight_projectid.html)。 **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及 |
#### 请求参数
表2请求Header参数 
| 参数             | 是否必选 | 参数类型   | 描述                                                                                                                                                                  |
|:---|:---|:---|:---|
| X-Workspace-Id | 是    | String | **参数解释：** 工作空间ID。获取方法请参见[获取工作空间ID](https://support.huaweicloud.com/api-dataartsinsight/dataartsinsight_workspaceid.html)。 **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及 |
| X-Auth-Token   | 是    | String | **参数解释：** 用户Token。通过调用IAM服务获取IAM用户Token接口获取，接口返回的响应消息头中"X-Subject-Token"就是需要获取的用户Token。 **约束限制：** 不涉及 **取值范围：** 不涉及 **默认取值：** 不涉及                                   |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数               | 参数类型                                                                 | 描述                                     |
|:---|:---|:---|
| caption          | String                                                               | **参数解释：** 数据集语义化名称。 **取值范围：** 不涉及      |
| domain_id        | String                                                               | **参数解释：** 租户ID。 **取值范围：** 不涉及          |
| ds_id            | String                                                               | **参数解释：** 数据源ID。 **取值范围：** 不涉及         |
| ds_type          | String                                                               | **参数解释：** 数据源类型。 **取值范围：** 不涉及         |
| id               | String                                                               | **参数解释：** 数据集ID。 **取值范围：** 不涉及         |
| logical_schema   | [LogicalSchema] object   | 数据集逻辑schema。                           |
| physical_schema  | [PhysicalSchema] object | 数据集物理schema。                           |
| project_id       | String                                                               | **参数解释：** 项目ID。 **取值范围：** 不涉及          |
| version          | String                                                               | **参数解释：** 数据集版本。 **取值范围：** - 1.0 - 2.0 |
| workspace_id     | String                                                               | **参数解释：** 工作空间ID。 **取值范围：** 不涉及        |
| create_date      | Long                                                                 | **参数解释：** 创建时间戳。 **取值范围：** 不涉及         |
| create_user      | String                                                               | **参数解释：** 创建者ID。 **取值范围：** 不涉及         |
| create_user_name | String                                                               | **参数解释：** 创建者名称。 **取值范围：** 不涉及         |
| update_date      | Long                                                                 | **参数解释：** 更新时间戳。 **取值范围：** 不涉及         |
| update_user      | String                                                               | **参数解释：** 更新者ID。 **取值范围：** 不涉及         |
| update_user_name | String                                                               | **参数解释：** 更新者名称。 **取值范围：** 不涉及         |
| resource_code    | String                                                               | **参数解释：** 数据集资源标识。 **取值范围：** 不涉及       |
   
 表4LogicalSchema 
| 参数           | 参数类型                                                                                 | 描述        |
|:---|:---|:---|
| field_schema | [DatasetFieldSchemaVO] object     | 字段schema。 |
| relations    | Array of [DatasetRelationVO] objects | 物理表关系。    |
| variables    | Array of [SqlVariable] objects             | SQL变量列表。  |
   
 表5DatasetFieldSchemaVO 
| 参数         | 参数类型                                                                     | 描述  |
|:---|:---|:---|
| dimensions | Array of [DimensionVo] objects | 维度。 |
| measures   | Array of [MeasureVo] objects     | 度量。 |
   
 表6DimensionVo 
| 参数          | 参数类型                                                                 | 描述                                 |
|:---|:---|:---|
| caption     | String                                                               | **参数解释：** 维度语义化名。 **取值范围：** 不涉及    |
| cube_id     | String                                                               | **参数解释：** 维度所属物理表ID。 **取值范围：** 不涉及 |
| description | String                                                               | **参数解释：** 维度描述。 **取值范围：** 不涉及      |
| id          | String                                                               | **参数解释：** 维度ID。 **取值范围：** 不涉及      |
| hierarchies | Array of [Hierarchy] objects | 层级结构                               |
   
 表7Hierarchy 
| 参数      | 参数类型                                                             | 描述                                |
|:---|:---|:---|
| caption | String                                                           | **参数解释：** 层级结构语义化名。 **取值范围：** 不涉及 |
| levels  | Array of [LevelVO] objects | 层级结构                              |
   
 表8LevelVO 
| 参数                 | 参数类型    | 描述                                                                                                                                                                                                        |
|:---|:---|:---|
| caption            | String  | **参数解释：** 语义化名。 **取值范围：** 不涉及                                                                                                                                                                             |
| column_formula     | String  | **参数解释：** level表达式。 **取值范围：** 不涉及                                                                                                                                                                         |
| data_type          | String  | **参数解释：** 字段类型。 **取值范围：** - STRING：字符 - DATE：日期 - DATETIME：日期时间                                                                                                                                           |
| expansion_type     | Integer | **参数解释：** 扩展字段类型。 **取值范围：** - 0：普通扩展字段 - 1：聚合扩展字段                                                                                                                                                         |
| id                 | String  | **参数解释：** level ID。 **取值范围：** 不涉及                                                                                                                                                                         |
| is_expansion       | Integer | **参数解释：** 是否为扩展字段。 **取值范围：** - 0：不是 - 1：是                                                                                                                                                                 |
| level_type         | String  | **参数解释：** level类型（时间字段有level类型值）。 **取值范围：** - yearLevel：年 - quarterLevel：季 - monthLevel：月 - weekLevel：周 - dayLevel：天 - hourLevel：小时 - minuteLevel：分钟 - secondLevel：秒 - ymdhmsLevel：年月时分秒 - ymdhLevel：年月时。 |
| origin_column_name | String  | **参数解释：** 原始字段名称。 **取值范围：** 不涉及                                                                                                                                                                           |
| origin_column_type | String  | **参数解释：** 原始字段类型。 **取值范围：** 不涉及                                                                                                                                                                           |
| origin_data_type   | String  | **参数解释：** 转换前的数据类型。 **取值范围：** - STRING：字符 - DATE：日期 - DATETIME：日期时间                                                                                                                                       |
   
 表9MeasureVo 
| 参数                 | 参数类型    | 描述                                                                              |
|:---|:---|:---|
| caption            | String  | **参数解释：** 度量语义化名。 **取值范围：** 不涉及                                                 |
| column_formula     | String  | **参数解释：** 度量字段表达式。 **取值范围：** 不涉及                                                |
| cube_id            | String  | **参数解释：** 字段所属物理表ID。 **取值范围：** 不涉及                                              |
| data_type          | String  | **参数解释：** 数据类型。 **取值范围：** - STRING：字符 - NUMBER：数字 - DATE：日期 - DATETIME：日期时间     |
| expansion_type     | Integer | **参数解释：** 扩展字段类型。 **取值范围：** - 0：普通扩展字段 - 1：聚合扩展字段                               |
| id                 | String  | **参数解释：** 度量ID。 **取值范围：** 不涉及                                                   |
| is_expansion       | Integer | **参数解释：** 是否为扩展字段。 **取值范围：** - 0：不是 - 1：是                                       |
| origin_column_name | String  | **参数解释：** 原始字段名称。 **取值范围：** 不涉及                                                 |
| origin_column_type | String  | **参数解释：** 原始字段类型。 **取值范围：** 不涉及                                                 |
| origin_data_type   | String  | **参数解释：** 转换前的数据类型。 **取值范围：** - STRING：字符 - NUMBER：数字 - DATE：日期 - DATETIME：日期时间 |
   
 表10DatasetRelationVO 
| 参数        | 参数类型                                                                         | 描述                                                                             |
|:---|:---|:---|
| join_type | String                                                                       | **参数解释：** 关联类型。 **取值范围：** - left join：左连接 - right join：右连接 - inner join：内连接    |
| joins     | Array of [DatasetJoinVO] objects | 关联键。                                                                           |
| relation  | String                                                                       | **参数解释：** 关系类型。 **取值范围：** - one-to-one：1对1 - one-to-many：1对多 - many-to-one：多对1 |
| source    | String                                                                       | **参数解释：** 源表ID。 **取值范围：** 不涉及                                                  |
| target    | String                                                                       | **参数解释：** 目标表ID。 **取值范围：** 不涉及                                                 |
   
 表11DatasetJoinVO 
| 参数          | 参数类型   | 描述                                                       |
|:---|:---|:---|
| condition   | String | **参数解释：** 关系。 **取值范围：** 不涉及                              |
| source_key  | String | **参数解释：** 源字段ID。 **取值范围：** 不涉及                           |
| source_type | String | **参数解释：** 源字段类型 **取值范围：** - dimension：维度 - measure：度量    |
| target_key  | String | **参数解释：** 目标字段ID。 **取值范围：** 不涉及                          |
| target_type | String | **参数解释：** 目标字段类型 。 **取值范围：** - dimension：维度 - measure：度量 |
   
 表12SqlVariable 
| 参数             | 参数类型             | 描述                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| default_values | Array of objects | **参数解释：** 变量默认值。 **取值范围：** 不涉及                                                                                                                                                                                                                                                                                  |
| format         | String           | **参数解释：** 变量格式，针对日期时间类型变量有效。 **取值范围：** 不涉及                                                                                                                                                                                                                                                                      |
| name           | String           | **参数解释：** 变量名称。 **取值范围：** 不涉及                                                                                                                                                                                                                                                                                   |
| type           | String           | **参数解释：** 变量类型，目前支持文本、数值、日期、系统变量等类型。 **取值范围：** - STRING：普通文本类型，组装执行sql时"输入值"使用单引号包裹，如：'value' - NUMBER：整数或小数类型，组装执行sql时，直接拼接输入值 - YEARREGION：日期-年类型 - QUARTERREGION：日期-年季类型 - MONTHREGION：日期-年月类型 - DATEREGION：日期-年月日类型 - YMDHMSREGION：日期-年月日时分秒类型 - SYSTEM：系统变量，无法指定具体值，由系统后台填写，如："访问用户名称"后台将当前访问用户名作为值组装执行sql |
| use_scope      | String           | **参数解释：** 变量作用域。 **取值范围：** - dataset：当前数据集范围 - global：全局                                                                                                                                                                                                                                                        |
   
 表13PhysicalSchema 
| 参数     | 参数类型                                                                           | 描述    |
|:---|:---|:---|
| tables | Array of [DatasetTableVO] objects | 物理表信息 |
   
 表14DatasetTableVO 
| 参数            | 参数类型    | 描述                                |
|:---|:---|:---|
| id            | String  | **参数解释：** 表ID。 **取值范围：** 不涉及      |
| database_name | String  | **参数解释：** 数据库。 **取值范围：** 不涉及      |
| schema_name   | String  | **参数解释：** schema名称。 **取值范围：** 不涉及 |
| table_name    | String  | **参数解释：** 表名。 **取值范围：** 不涉及       |
| table_type    | String  | **参数解释：** 数据集类型。 **取值范围：** 不涉及    |
| sql_text      | String  | **参数解释：** 查询SQL。 **取值范围：** 不涉及    |
| is_fact_table | Boolean | **参数解释：** 是否为端点表。 **取值范围：** 不涉及   |
   
#### 请求示例
获取数据集详情。
```
GET https://{endpoint}/v2/{project_id}/datasets/{dataset_id}/metadata
```
#### 响应示例
**状态码：200**
获取数据集详情成功。
```
{
  "create_date" : 1705561719385,
  "create_user" : "cfcxxxxxxxxxxxxxxxxxxxbfe8",
  "create_user_name" : "d30012451",
  "update_date" : 1705561719385,
  "update_user" : "cfcxxxxxxxxxxxxxxxxxxxxxxx6bbfe8",
  "update_user_name" : "d30012451",
  "project_id" : "34bxxxxxxxxxxxxxxxxxxxxxcc17bd",
  "workspace_id" : "d39xxxxxxxxxxxxxxxxxxxxxxb2d5e",
  "id" : "d1376d8b-14dc-41ba-8ff8-032455e9da58",
  "caption" : "测试数据集",
  "version" : "2.0",
  "ds_id" : "2eaaxxxxxxxxxxxxxxxxxxxx134fae2d4",
  "ds_type" : "DWS",
  "domain_id" : "10ae4xxxxxxxxxxxxxxxxxxxxxxd003",
  "resource_code" : "finaCode",
  "physical_schema" : {
    "tables" : [ {
      "id" : "dxxxxxxx-14dc-41ba-8ff8-032455e9da58",
      "database_name" : "modernbi_demo",
      "schema_name" : "autotest",
      "table_name" : "sql_order_info",
      "table_type" : "sql",
      "sql_text" : "select * from autotest.order_info",
      "is_fact_table" : true
    }, {
      "id" : "xxxxxxxxxxxx-be73-4316-a9cb-d80f44d9c334",
      "database_name" : "modernbi_demo",
      "schema_name" : "autotest",
      "table_name" : "order_info",
      "table_type" : "table",
      "sql_text" : "",
      "is_fact_table" : false
    } ]
  },
  "logical_schema" : {
    "field_schema" : {
      "measures" : [ ],
      "dimensions" : [ {
        "id" : "xxxxxxxxxx-14dc-41ba-8ff8-032455e9da58.id",
        "caption" : "id",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "id",
          "levels" : [ {
            "id" : "dxxxxxxxxxxx-14dc-41ba-8ff8-032455e9da58.id",
            "caption" : "id",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "id",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "id",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "xxxxxxxxxxxx-14dc-41ba-8ff8-032455e9da58"
      }, {
        "id" : "xxxxxxxb-14dc-41ba-8ff8-032455e9da58.product_id",
        "caption" : "product_id",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "product_id",
          "levels" : [ {
            "id" : "dxxxxxxx-14dc-41ba-8ff8-032455e9da58.product_id",
            "caption" : "product_id",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "product_id",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "product_id",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "dxxxxxxxxxx-14dc-41ba-8ff8-032455e9da58"
      }, {
        "id" : "dxxxxxxxxx-14dc-41ba-8ff8-032455e9da58.product_name",
        "caption" : "product_name",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "product_name",
          "levels" : [ {
            "id" : "dxxxxxxxx-14dc-41ba-8ff8-032455e9da58.product_name",
            "caption" : "product_name",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "product_name",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "product_name",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "xxxxxxx-14dc-41ba-8ff8-032455e9da58"
      }, {
        "id" : "dxxxxxxxx-be73-4316-a9cb-d80f44d9c334.id",
        "caption" : "id1",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "id1",
          "levels" : [ {
            "id" : "dxxxxxxxxxxc-be73-4316-a9cb-d80f44d9c334.id",
            "caption" : "id1",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "id",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "id",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "xxxxxxxxxx-be73-4316-a9cb-d80f44d9c334"
      }, {
        "id" : "dxxxxxxxx-be73-4316-a9cb-d80f44d9c334.product_id",
        "caption" : "product_id1",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "product_id1",
          "levels" : [ {
            "id" : "dxxxxx-be73-4316-a9cb-d80f44d9c334.product_id",
            "caption" : "product_id1",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "product_id",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "product_id",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "dxxxxxxbe73-4316-a9cb-d80f44d9c334"
      }, {
        "id" : "dxxxx-be73-4316-a9cb-d80f44d9c334.product_name",
        "caption" : "product_name1",
        "dimension_type" : "StandardDimension",
        "hierarchies" : [ {
          "caption" : "product_name1",
          "levels" : [ {
            "id" : "xxxxxxxxxxx-be73-4316-a9cb-d80f44d9c334.product_name",
            "caption" : "product_name1",
            "data_type" : "STRING",
            "origin_data_type" : "STRING",
            "origin_column_name" : "product_name",
            "origin_column_type" : "varchar(255)",
            "column_formula" : "product_name",
            "level_type" : null,
            "is_expansion" : 0,
            "expansion_type" : 0
          } ]
        } ],
        "cube_id" : "dxxxxxxxxxxx-be73-4316-a9cb-d80f44d9c334"
      } ]
    },
    "variables" : null,
    "relations" : [ {
      "source" : "xxxxxxxxx-14dc-41ba-8ff8-032455e9da58",
      "target" : "dxxxxxxxxxxxxxx-be73-4316-a9cb-d80f44d9c334",
      "join_type" : "left join",
      "relation" : "many-to-one",
      "joins" : [ {
        "source_key" : "product_id",
        "source_type" : "dimension",
        "target_key" : "product_id",
        "target_type" : "dimension",
        "condition" : "equal-to"
      } ]
    } ]
  }
}
```
#### 状态码
| 状态码 | 描述         |
|:---|:---|
| 200 | 获取数据集详情成功。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-dataartsinsight/ErrorCode.html)。
