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.
Try it out
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
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
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. |