Download execution result¶
Download a CSV file of SQL query results that were successfully executed by the current identity.
HTTP
POST $CLOUDSIGMA_API_BASE/query/result/download
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the execution status, confirm that the status is success and obtain the result ID (statement_id). The response body is a CSV file, not JSON.
Request¶
Shell
curl -X POST "$CLOUDSIGMA_API_BASE/query/result/download" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"statement_id\":\"$STATEMENT_ID\"}" \
--output result.csv
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
statement_id | string | Required | The result ID of a successful query execution. |
Successful response¶
On success, a CSV file is returned, which the example command saves as result.csv. For example, after querying the order number, customer name and amount, the download content is as follows:
Text
order_id,customer_name,amount
1001,王小明,128.50
1002,李华,89.00
1003,Chen Wei,256.00
JSON
{}
The response header contains the actual file name and file size:
Error response¶
JSON
{
"code": 404,
"message": "SQL 查询结果不存在"
}
| Field | Type | Description |
|---|---|---|
code | string | Error code. |
msg | string | Readable error message. |
data | null | `null` in an error response. |
Follow-up operations¶
Use query execution result when you need to read by page.
Last updated on