Saving or Modifying a Dataset
Function
This API is used to save or modify datasets.
URI
POST /v1/{project_id}/datasets/save
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Workspace-Id |
Yes |
String |
Workspace ID. For how to obtain it, see Obtaining a Workspace ID. |
X-Auth-Token |
Yes |
String |
User token. Obtain a user token by calling IAM's "Obtaining a User Token" API. X-Subject-Token in the response header is the desired user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
No |
String |
Dataset ID. |
caption |
Yes |
String |
Semantic name of a dataset. |
status |
No |
String |
Dataset status. The value can be 0 or 1. |
description |
No |
String |
Dataset description. |
ds_id |
Yes |
String |
Data source ID. |
ds_name |
No |
String |
Data source name. |
ds_type |
No |
String |
Data source type. |
table_type |
Yes |
String |
Dataset type. The options include:
|
resource_code |
No |
String |
Dataset resource ID. |
physical_schema |
Yes |
Table 4 object |
Physical schema of the dataset. |
logical_schema |
Yes |
Table 6 object |
Logical schema of the dataset. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tables |
Yes |
Array of Table 5 objects |
Physical tables. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
database_name |
Yes |
String |
Database. |
is_fact_table |
Yes |
Boolean |
Whether the table is an endpoint table. |
schema_name |
No |
String |
Schema. |
sql_text |
No |
String |
Query SQL. |
table_name |
Yes |
String |
Table name. |
table_type |
Yes |
String |
Table type. The options include:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
filed_schema |
No |
Table 7 object |
Field selection information. |
variables |
No |
Array of Table 9 objects |
List of SQL variables. |
relations |
No |
Array of Table 10 objects |
Physical table relations. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
columns |
No |
Array of Table 8 objects |
Field selection list and field name assignment. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
caption |
Yes |
String |
Field name. |
origin_column_name |
Yes |
String |
Physical name of a field, meaning the name in the table. |
schema_name |
No |
String |
Field schema. |
table_name |
Yes |
String |
Name of the table where the field is. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
default_values |
No |
Array of objects |
Default variable value. |
format |
No |
String |
Variable format, which is valid only for variables of the date and time type. |
name |
Yes |
String |
Variable name. |
type |
Yes |
String |
Variable type. The options include STRING, NUMBER, DATE, DATETIME, and TIMESTAMP. Enumerated values:
|
use_scope |
Yes |
String |
Variable scope. The options are dataset and global. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
source_database_name |
Yes |
String |
Name of the database the source table belongs to. |
source_schema |
No |
String |
Name of the schema the source table belongs to. |
source_table_name |
Yes |
String |
Source table name. |
target_database_name |
Yes |
String |
Name of the database the target table belongs to. |
target_schema |
No |
String |
Name of the schema the target table belongs to. |
target_table_name |
Yes |
String |
Target table name. |
join_type |
Yes |
String |
Join type. |
relation |
Yes |
String |
Relation type. |
joins |
Yes |
Array of Table 11 objects |
Join key. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
caption |
String |
Semantic name of a dataset. |
domain_id |
String |
Tenant ID. |
ds_id |
String |
Data source ID. |
ds_type |
String |
Data source type. |
id |
String |
Dataset ID. |
logical_schema |
Table 13 object |
Logical schema of the dataset. |
physical_schema |
Table 22 object |
Physical schema of the dataset. |
project_id |
String |
Project ID. |
version |
String |
Dataset version. The default value is 2.0. The options include 1.0 and 2.0. |
workspace_id |
String |
Workspace ID. |
create_date |
Long |
Creation timestamp. |
create_user |
String |
Creator ID. |
create_user_name |
String |
Creator name. |
update_date |
Long |
Update timestamp. |
update_user |
String |
ID of the user who performs the update. |
update_user_name |
String |
Name of the user who performs the update. |
resource_code |
String |
Dataset resource ID. |
Parameter |
Type |
Description |
---|---|---|
field_schema |
Table 14 object |
Field schema. |
relations |
Array of Table 19 objects |
Physical table relations. |
variables |
Array of Table 21 objects |
List of SQL variables. |
Parameter |
Type |
Description |
---|---|---|
dimensions |
Array of Table 15 objects |
Dimensions. |
measures |
Array of Table 18 objects |
Metrics. |
Parameter |
Type |
Description |
---|---|---|
caption |
String |
Semantic name of a dimension. |
cube_id |
String |
ID of the physical table a dimension belongs to. |
description |
String |
Dimension description. |
id |
String |
Dimension ID. |
hierarchies |
Array of Table 16 objects |
Dimension levels. |
Parameter |
Type |
Description |
---|---|---|
caption |
String |
Semantic name of a hierarchical structure. |
levels |
Array of Table 17 objects |
Hierarchy levels. |
Parameter |
Type |
Description |
---|---|---|
caption |
String |
Semantic name. |
column_formula |
String |
Level expression. |
data_type |
String |
Field type. The options are STRING, DATE, and DATETIME. Enumerated values:
|
expansion_type |
Integer |
Extension field type. The options are 0 (common extension field) and 1 (aggregation extension field). |
id |
String |
ID. |
is_expansion |
Integer |
Whether a field is an extension field. The options are 0 (no) and 1 (yes). Enumerated values:
|
level_type |
String |
Level type. |
origin_column_name |
String |
Original field name. |
origin_column_type |
String |
Original field type. |
origin_data_type |
String |
Data type before conversion. The options are STRING, DATE, and DATETIME. Enumerated values:
|
Parameter |
Type |
Description |
---|---|---|
caption |
String |
Semantic name of a metric. |
column_formula |
String |
Field expression of a metric. |
cube_id |
String |
ID of the physical table a field belongs to. |
data_type |
String |
Data type. The options are STRING, NUMBER, DATE, and DATETIME. Enumerated values:
|
expansion_type |
Integer |
Extension field type. The options are 0 (common extension field) and 1 (aggregation extension field). |
id |
String |
Metric ID. |
is_expansion |
Integer |
Whether a field is an extension field. The options are 0 (no) and 1 (yes). |
origin_column_name |
String |
Original field name. |
origin_column_type |
String |
Original field type. |
origin_data_type |
String |
Data type before conversion. The options are STRING, NUMBER, DATE, and DATETIME. Enumerated values:
|
Parameter |
Type |
Description |
---|---|---|
join_type |
String |
Join type. The options are left join, right join, and inner join. |
joins |
Array of Table 20 objects |
Join key. |
relation |
String |
Relation type. The options include one-to-one, one-to-many, and many-to-one. |
source |
String |
Source table ID. |
target |
String |
Target table ID. |
Parameter |
Type |
Description |
---|---|---|
condition |
String |
Relation. The value is equal-to. |
source_key |
String |
Source field ID. |
source_type |
String |
Source field type. The options are dimension and measure. |
target_key |
String |
Target field ID. |
target_type |
String |
Target field type. The options are dimension and measure. |
Parameter |
Type |
Description |
---|---|---|
default_values |
Array of objects |
Default variable value. |
format |
String |
Variable format, which is valid only for variables of the date and time type. |
name |
String |
Variable name. |
type |
String |
Variable type. The options include STRING, NUMBER, DATE, DATETIME, and TIMESTAMP. Enumerated values:
|
use_scope |
String |
Variable scope. The options are dataset and global. |
Parameter |
Type |
Description |
---|---|---|
tables |
Array of Table 23 objects |
Physical tables. Array length: 0 to 2,147,483,647 elements |
Example Request
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" } ] } ] } }
Example Response
None
Status Codes
Status Code |
Description |
---|---|
200 |
The dataset is successfully saved or modified. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot