Submitting a SQL Job (Discarded)
Function
This API is used to submit jobs to a queue using SQL statements.
This API has been discarded and is not recommended.
The job types support DDL, DCL, IMPORT, EXPORT, QUERY, and INSERT. Functions of IMPORT and EXPORT are the same as those described in Importing Data (Discarded) and Exporting Data (Discarded). The difference lies in the implementation method.
Additionally, you can use other APIs to query and manage jobs. For details, see the following sections:
- Querying Job Status
- Querying Job Details
- Querying the Job Execution Result-Method 1 (Discarded)
- Exporting Query Results
- Querying All Jobs
- Canceling a Job (Discarded)
- This API is synchronous if job_type in the response message is DCL.
- Information described in this section has been disused. You are advised to view the information described in Submitting a SQL Job (Recommended).
URI
- URI format
- Parameter description
Table 1 URI parameters Parameter
Mandatory
Description
project_id
Yes
Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.
queue_name
Yes
Current queue name. Resources of the queue are used for computing if SQL requires resources.
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
sql |
Yes |
String |
SQL statement that you want to execute. |
currentdb |
No |
String |
Database where the SQL statement is executed. This parameter does not need to be configured during database creation. |
conf |
No |
Array of objects |
User-defined parameter that applies to the job. Currently, the following configuration items are supported:
|
Response
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
is_success |
Yes |
Boolean |
If job_type is set to DCL, this parameter indicates whether the request is successfully executed. Value true indicates that the request is successfully executed. |
message |
Yes |
String |
System prompt. If execution succeeds, the parameter setting may be left blank. |
job_id |
Yes |
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_type |
Yes |
String |
Type of a job. Job types include the following:
|
schema |
No |
Array of Map |
If the statement type is DDL, the column name and type of DDL are displayed. |
rows |
No |
Array of objects |
When the statement type is DDL, results of the DDL are displayed. |
Example
- Example request
{ "currentdb": "db1", "sql": "desc table1", "conf": [ "dli.sql.shuffle.partitions = 200" ] }
- Example response (successful request)
{ "is_success": true, "message": "", "job_id": "8ecb0777-9c70-4529-9935-29ea0946039c", "job_type": "DDL", "schema": [ { "col_name": "string" }, { "data_type": "string" }, { "comment": "string" } ], "rows": [ [ "c1", "int", null ], [ "c2", "string", null ] ] }
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 Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot