RunDataResultAnalysis - Analyze query results
Analyzes structured query results and generates visualization information.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:
-
Action: a specific permission.
-
Access level: the access level of an action. Valid values: Write, Read, and List.
-
Resource type: the types of resources for which the action supports authorization:
- Required resource types are marked with an asterisk (*).
- Actions that do not support resource-level authorization use
All resources.
-
Condition key: a condition key defined by the cloud service.
-
Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| dataanalysisgbi:RunDataResultAnalysis | none | *All resources * |
| None |
Request syntax
POST /gbi/runDataResultAnalysis HTTP/1.1
Request parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
workspaceId | string | Yes | The ID of the Model Studio workspace used for the current request. | llm-2v3934xtp49esw64 |
body | object | No | The request body parameters. | |
sqlData | object | No | The structured data queried after the SQL is executed. This parameter is required in the current scenario. Details sqlData example { "column": [ "month", "total_received" ], "data": [ { "month": "2024-01", "total_received": "603" }, { "month": "2024-02", "total_received": "749" }, { "month": "2024-03", "total_received": "1311" }, { "month": "2024-04", "total_received": "1003" }, { "month": "2024-05", "total_received": "726" }, { "month": "2024-06", "total_received": "791" }, { "month": "2024-07", "total_received": "60" } ] } | |
column | array | No | The list of specific field names queried in the SQL execution results. | |
Column | string | No | The specific column name queried in the SQL execution results. | month |
data | array<object> | No | The list of structured information corresponding to the column names in the SQL execution results. For the detailed structure, see the sqlData example above. | |
Data | object | No | The structured information corresponding to the column names in the SQL execution results. Each item represents a row of data, and its fields must correspond one-to-one to the column header list. | |
string | No | The specific content of a data record corresponding to the current column name. | 2024-01 | |
analysisMode | string | No | The visualization type to generate. You can generate charts only or text analysis only. Valid values:
| all |
requestId | string | Yes | The request ID. This request ID is the requestId returned by the RunSqlGeneration operation. If the specified requestId has not been processed by RunSqlGeneration, the request is rejected. | FF76AD3F-8B32-567E-819B-0D3738917006 |
Response parameters
| Name | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| data | object | The response results. | |
| errorMessage | string | The error message. | Access was denied, message: No such namespace namespaces/tech-scp-chain7. |
| event | string | The event type. Valid values:
| result |
| requestId | string | The ID of the current request. | DA2578F7-88A5-5D6E-9305-33E724E97D60 |
| visualization | object | The information required for display in the visualization module. | |
| data | object | The data list. | |
| plotType | string | The chart display type for visualization. | bar |
| xAxis | array | The list of fields displayed on a specific x-axis. | |
| xAxis | string | The field displayed on a specific x-axis. | product_name |
| yAxis | array | The list of fields displayed on a specific y-axis. | |
| yAxis | string | The field displayed on a specific y-axis. | total_sales |
| text | string | The analysis summary of the SQL execution results. | The query results show that all products with sales exceeding 5 in the past two years include: the 2L large-capacity air fryer sold 109 units, the Youth Edition sports band sold 119 units, the 2L large-capacity fully automatic soymilk maker sold 106 units, the fast-charging edition wireless Bluetooth earphones sold 84 units, the 2L large-capacity portable juicer sold 136 units, the Youth Edition smartwatch sold 104 units, the wall-mounted eye-protection desk lamp sold 102 units, the P30 phone 8+256G sold 83 units, the 2L large-capacity electric kettle sold 84 units, the men's electric makeup brush set sold 197 units, the suitcase sold 82 units, the bracelet sold 101 units, the necklace sold 84 units, the hair chain sold 89 units, the wristwatch sold 98 units, the ring sold 157 units, the genuine leather bag sold 136 units, the trench coat sold 76 units, the sports travel bag sold 91 units, the silk scarf sold 265 units, the 1L mini air fryer sold 85 units, the Deluxe sports band sold 132 units, the 1L mini fully automatic soymilk maker sold 81 units, the Deluxe edition wireless Bluetooth earphones (green) sold 122 units, the 1L mini portable juicer sold 76 units, the Deluxe smartwatch sold 76 units, the stick-on eye-protection desk lamp sold 109 units, the M60 phone 16+512G sold 109 units, the 1L mini electric kettle sold 63 units, and the women's electric makeup brush set sold 158 units. |
| sql | string | The SQL statement generated in the current conversation. | select p.product_id, p.product_name, sum(o.quantity) as total_sales from products p join orders o on p.product_id = o.product_id where o.order_date between '2022-10-22' and '2024-10-22' group by p.product_id, p.product_name having total_sales > 5 |
| rewrite | string | The rewritten user input. | Which products sold more than five units in the past two years? |
Examples
Sample success response
JSON format
{
"data": {
"errorMessage": "Access was denied, message: No such namespace namespaces/tech-scp-chain7.",
"event": "result",
"requestId": "DA2578F7-88A5-5D6E-9305-33E724E97D60",
"visualization": {
"data": {
"plotType": "bar",
"xAxis": [
"product_name"
],
"yAxis": [
"total_sales"
]
},
"text": "查询结果显示,在过去两年中销量超过5的所有产品包括:2L大容量空气炸锅销售了109件,青春版运动手环销售了119件,2L大容量全自动豆浆机销售了106件,无线蓝牙耳机快充版销售了84件,2L大容量便携式榨汁机销售了136件,青春版智能手表销售了104件,挂壁式护眼台灯销售了102件,P30手机8+256G销售了83件,2L大容量电热水壶销售了84件,男士电动化妆刷套装销售了197件,旅行箱销售了82件,手链销售了101件,项链销售了84件,头饰发链销售了89件,腕表销售了98件,戒指销售了157件,真皮皮包销售了136件,风衣大衣销售了76件,运动旅行包销售了91件,丝巾销售了265件,1L迷你空气炸锅销售了85件,豪华款运动手环销售了132件,1L迷你全自动豆浆机销售了81件,豪华版无线蓝牙耳机(绿色)销售了122件,1L迷你便携式榨汁机销售了76件,豪华款智能手表销售了76件,粘贴式护眼台灯销售了109件,M60手机16+512G销售了109件,1L迷你电热水壶销售了63件,女士电动化妆刷套装销售了158件。"
},
"sql": "select p.product_id, p.product_name, sum(o.quantity) as total_sales from products p join orders o on p.product_id = o.product_id where o.order_date between '2022-10-22' and '2024-10-22' group by p.product_id, p.product_name having total_sales > 5",
"rewrite": "过去两年中,销量超过5的产品有哪些"
}
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 401 | Internal.Error | Bad Request: Internal Error. | An internal error occurred. Contact customer service for troubleshooting. |
| 401 | NoAuth | Bad Request: Workspace.Illegal.Auth. | The current account does not have permission to access the specified workspace. |
| 401 | NoResourceAuth | Bad Request: Resource Auth Error. | You do not have permission to access the requested resource. Make sure that the requested resource belongs to the workspace specified in the request parameters. |
| 401 | Invalid.RequestId | Bad Request: Invalid RequestId. | The requestId is invalid or has expired. |
For more error codes, see Error Center.