This API is used to export results returned from the query using SQL statements to OBS. Only the query result of QUERY jobs can be exported.
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID. |
job_id |
Yes |
String |
Job ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
data_path |
Yes |
String |
Path for storing the exported data. Currently, data can be stored only on OBS. The OBS path cannot contain folders, for example, the path folder in the sample request. |
compress |
No |
String |
Compression format of exported data. Currently, gzip, bzip2, and deflate are supported. The default value is none, indicating that data is not compressed. |
data_type |
Yes |
String |
Storage format of exported data. Currently, only CSV and JSON are supported. |
queue_name |
No |
String |
Name of the queue that is specified to execute a task. If no queue is specified, the default queue is used. |
export_mode |
No |
String |
Export mode. The parameter value can be ErrorIfExists or Overwrite. If export_mode is not specified, this parameter is set to ErrorIfExists by default.
|
with_column_header |
No |
Boolean |
Whether to export column names when exporting CSV and JSON data.
|
limit_num |
No |
Integer |
Number of data records to be exported. The default value is 0, indicating that all data records are exported. |
encoding_type |
No |
String |
Format of the data to be exported. The value can be utf-8, gb2312, or gbk. Value utf-8 will be used if this parameter is left empty. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
is_success |
Yes |
Boolean |
Indicates whether the request is successfully sent. Value true indicates that the request is successfully sent. |
message |
Yes |
String |
System prompt. If execution succeeds, the parameter setting may be left blank. |
job_id |
No |
String |
ID of a job returned after a job is generated and submitted by using SQL statements. The job ID can be used to query the job status and results. |
job_mode |
No |
String |
Job execution mode. The options are as follows:
|
{ "data_path": "obs://obs-bucket1/path", "data_type": "json", "compress": "gzip", "with_column_header": "true", "queue_name": "queue2", "limit_num": 10 }
{ "is_success": true, "message": "", "job_id": "37a40ef9-86f5-42e6-b4c6-8febec89cc20", "job_mode":"async" }
Table 4 describes the status code.
If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.