保存或修改数据集
功能介绍
保存或修改数据集。
URI
POST /v1/{project_id}/datasets/save
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID。获取方法请参见获取项目ID。 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Workspace-Id |
是 |
String |
工作空间ID。获取方法请参见获取工作空间ID。 |
X-Auth-Token |
是 |
String |
用户Token。通过调用IAM服务获取IAM用户Token接口,接口返回的响应消息头中“X-Subject-Token”就是需要获取的用户Token。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
id |
否 |
String |
数据集ID。 |
caption |
是 |
String |
数据集语义化名称。 |
status |
否 |
String |
数据集状态:0,1。 |
description |
否 |
String |
数据集描述。 |
ds_id |
是 |
String |
数据源ID。 |
ds_name |
否 |
String |
数据源名称。 |
ds_type |
否 |
String |
数据源类型。 |
table_type |
是 |
String |
数据集类型:
|
resource_code |
否 |
String |
数据集资源标识。 |
physical_schema |
是 |
表4 object |
数据集物理schema。 |
logical_schema |
是 |
表6 object |
数据集逻辑schema。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
database_name |
是 |
String |
数据库。 |
is_fact_table |
是 |
Boolean |
是否为端点表。 |
schema_name |
否 |
String |
模式。 |
sql_text |
否 |
String |
查询SQL。 |
table_name |
是 |
String |
表名。 |
table_type |
是 |
String |
表类型:
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
filed_schema |
否 |
表7 object |
字段选择信息。 |
variables |
否 |
Array of 表9 objects |
SQL变量列表。 |
relations |
否 |
Array of 表10 objects |
物理表关系。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
caption |
是 |
String |
字段名称。 |
origin_column_name |
是 |
String |
字段物理名称,即表中名称。 |
schema_name |
否 |
String |
字段所属schema。 |
table_name |
是 |
String |
字段所属名 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
default_values |
否 |
Array of objects |
变量默认值。 |
format |
否 |
String |
变量格式,针对日期时间类型变量有效。 |
name |
是 |
String |
变量名称 |
type |
是 |
String |
参数解释: 变量类型,目前支持文本、数值、日期、系统变量等类型。 约束限制: 不涉及 取值范围: 以下枚举值:
默认取值: 不涉及 |
use_scope |
是 |
String |
变量作用域,dataset|global。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
source_database_name |
是 |
String |
源表所属数据库名称。 |
source_schema |
否 |
String |
源表所属schema名称。 |
source_table_name |
是 |
String |
源表名称。 |
target_database_name |
是 |
String |
目标表所属数据库名称。 |
target_schema |
否 |
String |
目标表所属schema名称。 |
target_table_name |
是 |
String |
目标表名称。 |
join_type |
是 |
String |
关联类型。 |
relation |
是 |
String |
关系类型。 |
joins |
是 |
Array of 表11 objects |
关联键 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
caption |
String |
数据集语义化名称。 |
domain_id |
String |
租户ID。 |
ds_id |
String |
数据源ID。 |
ds_type |
String |
数据源类型。 |
id |
String |
数据集ID。 |
logical_schema |
表13 object |
数据集逻辑schema。 |
physical_schema |
表22 object |
数据集物理schema。 |
project_id |
String |
项目ID。 |
version |
String |
数据集版本:默认为2.0,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 |
数据集资源标识。 |
参数 |
参数类型 |
描述 |
---|---|---|
field_schema |
表14 object |
字段schema。 |
relations |
Array of 表19 objects |
物理表关系。 |
variables |
Array of 表21 objects |
SQL变量列表。 |
参数 |
参数类型 |
描述 |
---|---|---|
dimensions |
Array of 表15 objects |
维度。 |
measures |
Array of 表18 objects |
度量。 |
参数 |
参数类型 |
描述 |
---|---|---|
caption |
String |
维度语义化名。 |
cube_id |
String |
维度所属物理表ID。 |
description |
String |
维度描述。 |
id |
String |
维度ID。 |
hierarchies |
Array of 表16 objects |
维度层级。 |
参数 |
参数类型 |
描述 |
---|---|---|
caption |
String |
语义化名。 |
column_formula |
String |
level表达式。 |
data_type |
String |
字段类型,STRING|DATE|DATETIME。 枚举值:
|
expansion_type |
Integer |
扩展字段类型:0-普通扩展字段;1-聚合扩展字段。 |
id |
String |
ID。 |
is_expansion |
Integer |
是否为扩展字段:0-不是、1-是。 枚举值:
|
level_type |
String |
level类型。 |
origin_column_name |
String |
原始字段名称。 |
origin_column_type |
String |
原始字段类型。 |
origin_data_type |
String |
转换前的数据类型,STRING|DATE|DATETIME。 枚举值:
|
参数 |
参数类型 |
描述 |
---|---|---|
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。 枚举值:
|
参数 |
参数类型 |
描述 |
---|---|---|
join_type |
String |
关联类型,left join|right join|inner join。 |
joins |
Array of 表20 objects |
关联键。 |
relation |
String |
关系类型,one-to-one|one-to-many|many-to-one。 |
source |
String |
源表ID。 |
target |
String |
目标表ID。 |
参数 |
参数类型 |
描述 |
---|---|---|
condition |
String |
关系,equal-to。 |
source_key |
String |
源字段id。 |
source_type |
String |
源字段类型:dimension|measure。 |
target_key |
String |
目标字段ID。 |
target_type |
String |
目标字段类型:dimension|measure。 |
参数 |
参数类型 |
描述 |
---|---|---|
default_values |
Array of objects |
变量默认值。 |
format |
String |
变量格式,针对日期时间类型变量有效。 |
name |
String |
变量名称。 |
type |
String |
参数解释: 变量类型,目前支持文本、数值、日期、系统变量等类型。 约束限制: 不涉及 取值范围: 以下枚举值:
默认取值: 不涉及 |
use_scope |
String |
变量作用域,dataset|global。 |
请求示例
POST https://{endpoint}/v1/{project_id}/datasets/save
{
"id" : "string",
"caption" : "id",
"status" : "string",
"description" : "string",
"ds_id" : "string",
"ds_name" : "string",
"ds_type" : "string",
"table_type" : "table|sql",
"resource_code" : "string",
"physical_schema" : {
"tables" : [ {
"database_name" : "db_test",
"is_fact_table" : false,
"schema_name" : "public",
"sql_text" : "SELECT * FROM FACT_GDP",
"table_name" : "t_test",
"table_type" : "table"
} ]
},
"logical_schema" : {
"field_schema" : {
"columns" : [ {
"caption" : "age",
"origin_column_name" : "age",
"schema_name" : "public",
"table_name" : "modern_bi_0xxxx1c590b14d9xxxx35227166f7f02"
} ]
},
"variables" : [ {
"default_values" : [ "aaa", "bbb" ],
"format" : "yyyy-MM-dd",
"name" : "limit",
"type" : "STRING",
"use_scope" : "dataset"
} ],
"relations" : [ {
"source_database_name" : "string",
"source_schema" : "string",
"source_table_name" : "string",
"target_database_name" : "string",
"target_schema" : "string",
"target_table_name" : "string",
"join_type" : "string",
"relation" : "string",
"joins" : [ {
"condition" : "equal-to",
"source_key" : "city",
"target_key" : "city"
} ]
} ]
}
}
响应示例
无
状态码
状态码 |
描述 |
---|---|
200 |
保存或者修改数据集成功。 |
错误码
请参见错误码。