Skip to content

Update a Dataset

API Description

Use this API to update a dataset in the metrics platform.

API URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/dataset/update

For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.

Request Parameters

Common Request Parameters (Headers)

Parameter Type Required Description
tenant-id String Yes Tenant ID. Identifies the tenant for metric query content.
auth-type String Yes Authentication method. Supported values: UID, TOKEN, ACCOUNT, and APIKEY.
auth-value String Yes Authentication value corresponding to auth-type.

How to Obtain Common Parameters

To obtain tenant-id, select a metrics application in the top navigation bar of Aloudata CAN, choose API Integration from the left navigation menu, and copy it from the API Integration page. Set auth-value according to the selected auth-type.

image.png

Body Request Parameters

Main Table Parameters

Parameter Type Required Maximum Length Description
name String Yes 128 Dataset name. It is used as the unique identifier and cannot be modified.
displayName String Yes 128 Dataset display name.
description String No 256 Dataset description.
sourceInfo Object Yes - Source data information. See the sourceInfo parameter description.
defColumns List No - Field definition list. See the defColumns parameter description. If omitted or empty, the system retrieves fields from the data source again.
relations List No - List of relationships actively defined from this dataset.
partitionMapping Object No - Partition mapping configuration.
filterExpr String No - Dataset-level filter condition. We recommend passing an expression string.

sourceInfo Parameter Description

Parameter Type Required Maximum Length Description
name String Yes 128 Source data name.
displayName String No 128 Source data display name.
description String No 256 Source data description.
content String Yes - Source data content. For physical tables, this is usually the table GUID or fully qualified table name.
type String Yes 32 Source data type. Enumerated values: TABLE, SQL.
datasourceName String No 128 Data source name. Required when type=SQL.
datasourceItems Array Yes - Data source list. Only one element is supported. See the datasourceItems parameter description.

datasourceItems Parameter Description

Parameter Type Required Description
id String Yes Data source GUID.
name String Yes Data source name.
queryEngineType String Yes Query engine type, such as AIR.

defColumns Parameter Description

Parameter Type Required Maximum Length Description
name String Yes 128 Field name. It cannot be modified.
displayName String No 128 Field display name.
description String No 256 Field description.
type String Yes 32 Field type. Enumerated values: DIMENSION, MEASURE.
originDataType String Yes - Original data type, such as DECIMAL, VARCHAR, or TIMESTAMP.
isHidden Boolean No - Whether to hide the field.
isPartition Boolean No - Whether the field is a partition field.
isPrimaryKey Boolean No - Whether the field is a primary key field.
sourceColumn String No 128 Source field. Recommended for physical table fields.
expr String No - Field formula.
partitionMapping Object No - Field-level partition mapping configuration.

Response Parameters

Parameter Type Required Description
code String Yes API response code.
success Boolean Yes Whether the request succeeded.
errorMsg String No Error message.
detailErrorMsg String No Detailed error message.
traceId String Yes Trace ID for troubleshooting.
data Boolean Yes Whether the update succeeded.

Request Example

{
  "name": "oracle_product_1",
  "displayName": "oracle_product_1",
  "description": "oracle_product_1",
  "sourceInfo": {
    "name": "TB_PRODUCT",
    "displayName": "TB_PRODUCT",
    "description": "",
    "content": "fenghou_air11.`anymetrics_oracle.ALOUDATA`.TB_PRODUCT",
    "type": "TABLE",
    "datasourceItems": [
      {
        "id": "fenghou_air11",
        "name": "fenghou_air11",
        "queryEngineType": "AIR"
      }
    ]
  },
  "defColumns": [
    {
      "name": "CATEGORY_ID",
      "displayName": "CATEGORY_ID",
      "originDataType": "DECIMAL",
      "description": null,
      "isPartition": false,
      "type": "MEASURE",
      "expr": "[TB_PRODUCT/CATEGORY_ID]",
      "sourceColumn": "CATEGORY_ID"
    },
    {
      "name": "time",
      "displayName": "time",
      "type": "DIMENSION",
      "description": "",
      "expr": "now()",
      "originDataType": "TIMESTAMP",
      "isPartition": false
    }
  ]
}

Response Example

{
  "data": true,
  "success": true,
  "code": "200",
  "errorMsg": null,
  "detailErrorMsg": null,
  "traceId": "f6e656798ed241c789f7132823c46c6b.141.17194028392300357"
}