Files
doc-exports/docs/dli/api-ref/dli_02_0102.html
Su, Xiaomeng 6878ea6e04 dli_api_20250212
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2025-02-24 08:09:52 +00:00

399 lines
34 KiB
HTML

<a name="dli_02_0102"></a><a name="dli_02_0102"></a>
<h1 class="topictitle1">Submitting a SQL Job (Recommended)</h1>
<div id="body1516173559148"><div class="section" id="dli_02_0102__s51df1f9bf4784cf4a56c09b3973a2adc"><h4 class="sectiontitle">Function</h4><p id="dli_02_0102__p19059616154727">This API is used to submit jobs to a queue using SQL statements.</p>
<p id="dli_02_0102__p28587776153724">The job types support DDL, DCL, IMPORT, QUERY, and INSERT. The IMPORT function is the same as that described in <a href="dli_02_0019.html">Importing Data (Deprecated)</a>. The difference lies in the implementation method.</p>
<p id="dli_02_0102__p61093487155417">Additionally, you can use other APIs to query and manage jobs. For details, see the following sections:</p>
<ul id="dli_02_0102__ul57265221155430"><li id="dli_02_0102__li2265332155430"><a href="dli_02_0021.html">Querying Job Status</a></li><li id="dli_02_0102__li63874426155442"><a href="dli_02_0022.html">Querying Job Details</a></li><li id="dli_02_0102__li22944132155456"><a href="dli_02_0024.html">Exporting Query Results</a></li><li id="dli_02_0102__li55079334155611"><a href="dli_02_0025.html">Querying All Jobs</a></li><li id="dli_02_0102__li471186116448"><a href="dli_02_0104.html">Canceling a Job (Recommended)</a></li></ul>
<div class="note" id="dli_02_0102__note610404721091"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_02_0102__p6830133310502">This API is synchronous if <span class="parmname" id="dli_02_0102__parmname2973176210107"><b>job_type</b></span> in the response message is <span class="parmvalue" id="dli_02_0102__parmvalue6625926910107"><b>DCL</b></span>.</p>
</div></div>
</div>
<div class="section" id="dli_02_0102__s807a09edd221483999c7c51233072a4a"><h4 class="sectiontitle">URI</h4><ul id="dli_02_0102__en-us_topic_0069077806_ul16583492"><li id="dli_02_0102__en-us_topic_0069077806_li15033705">URI format<p id="dli_02_0102__p39332129102626"><a name="dli_02_0102__en-us_topic_0069077806_li15033705"></a><a name="en-us_topic_0069077806_li15033705"></a>POST /v1.0/{project_id}/jobs/submit-job</p>
</li><li id="dli_02_0102__li19112104310524">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__en-us_topic_0069077806_table9770605" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter</caption><thead align="left"><tr id="dli_02_0102__en-us_topic_0069077806_row35653836"><th align="left" class="cellrowborder" valign="top" width="14.27%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="dli_02_0102__en-us_topic_0069077806_p14983541266">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.16%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="dli_02_0102__en-us_topic_0069077806_p9981547619">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.3%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="dli_02_0102__p15306165714487">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="63.27%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="dli_02_0102__a9de737854caf4be3a07db76909948f18">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__row5320171434012"><td class="cellrowborder" valign="top" width="14.27%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077803_p43412436">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="11.16%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077803_p26746391">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="11.3%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="dli_02_0102__p1930695754816">String</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="dli_02_0102__p1310472724012">Project ID, which is used for resource isolation. For details about how to obtain its value, see <a href="dli_02_0183.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="dli_02_0102__s46f967e8024f453cb6cd43f3af264950"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__table6376584143542" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="dli_02_0102__row19110893143542"><th align="left" class="cellrowborder" valign="top" width="14.549999999999999%" id="mcps1.3.3.2.2.5.1.1"><p id="dli_02_0102__p42934984143542">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.79%" id="mcps1.3.3.2.2.5.1.2"><p id="dli_02_0102__p55181642143542">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.3%" id="mcps1.3.3.2.2.5.1.3"><p id="dli_02_0102__p40528033143542">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.36%" id="mcps1.3.3.2.2.5.1.4"><p id="dli_02_0102__p61545269143542">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__row16818917143542"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p4478514143542">sql</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p27215339143542">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p56958849143542">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p1036145143542">SQL statement that you want to execute.</p>
</td>
</tr>
<tr id="dli_02_0102__row48821488143542"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p17152532143542">currentdb</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p47177872143542">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p63311321143542">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p27943382143542">Database where the SQL statement is executed. This parameter does not need to be configured during database creation.</p>
</td>
</tr>
<tr id="dli_02_0102__row47659205154318"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p1846530915443">queue_name</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p3009358515443">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p6674625215443">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p32836715443">Name of the queue to which a job to be submitted belongs. The name can contain only digits, letters, and underscores (_), but cannot contain only digits or start with an underscore (_).</p>
</td>
</tr>
<tr id="dli_02_0102__row57451725143542"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p36740211143542">conf</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p23167106143542">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p64596322143542">Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p23997108143542">You can set the configuration parameters for the SQL job in the form of <strong id="dli_02_0102__b33514154110">Key/Value</strong>. For details about the supported configuration items, see <a href="#dli_02_0102__table334825142314">Table 3</a>.</p>
</td>
</tr>
<tr id="dli_02_0102__row12919491403"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p49794914011">tags</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p597149114018">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p451066135816">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p55101469587">Label of a job. For details, see <a href="#dli_02_0102__table9391124139">Table 4</a>.</p>
</td>
</tr>
<tr id="dli_02_0102__row17297103119146"><td class="cellrowborder" valign="top" width="14.549999999999999%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0102__p115341838131416">engine_type</p>
</td>
<td class="cellrowborder" valign="top" width="10.79%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0102__p12991314140">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.3%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0102__p52996312141">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.36%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0102__p12174591189">Type of the engine that executes jobs.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="dli_02_0102__table334825142314"></a><a name="table334825142314"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__table334825142314" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Configuration parameters description</caption><thead align="left"><tr id="dli_02_0102__row66396519230"><th align="left" class="cellrowborder" valign="top" width="29.43%" id="mcps1.3.3.3.2.4.1.1"><p id="dli_02_0102__p463913514234">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.83%" id="mcps1.3.3.3.2.4.1.2"><p id="dli_02_0102__p2639158232">Default Value</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54.74%" id="mcps1.3.3.3.2.4.1.3"><p id="dli_02_0102__p1963920542313">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__row1363935122313"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p56404542316">spark.sql.files.maxRecordsPerFile</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p1864016519235">0</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p186405592312">Maximum number of records to be written into a single file. If the value is zero or negative, there is no limit.</p>
</td>
</tr>
<tr id="dli_02_0102__row8640135142317"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p664017510239">spark.sql.autoBroadcastJoinThreshold</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p1664018542314">209715200</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p15640157231">Maximum size of the table that displays all working nodes when a connection is executed. You can set this parameter to <span class="parmvalue" id="dli_02_0102__parmvalue10816165872414"><b>-1</b></span> to disable the display.</p>
<div class="note" id="dli_02_0102__note1562136162513"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dli_02_0102__p166418366254">Currently, only the configuration unit metastore table that runs the <b><span class="cmdname" id="dli_02_0102__cmdname86941634172615">ANALYZE TABLE COMPUTE statistics noscan</span></b> command and the file-based data source table that directly calculates statistics based on data files are supported.</p>
</div></div>
</td>
</tr>
<tr id="dli_02_0102__row364020522314"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p146401254236">spark.sql.shuffle.partitions</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p176409516238">200</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p186400514233">Default number of partitions used to filter data for join or aggregation.</p>
</td>
</tr>
<tr id="dli_02_0102__row1664018513237"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p464005132313">spark.sql.dynamicPartitionOverwrite.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p4640185132312">false</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p278444731617">Whether DLI overwrites the partitions where data will be written into during runtime. If you set this parameter to <strong id="dli_02_0102__b176982232516">false</strong>, all partitions that meet the specified condition will be deleted before data overwrite starts. For example, if you set <strong id="dli_02_0102__b143841725142519">false</strong> and use INSERT OVERWRITE to write partition 2021-02 to a partitioned table that has the 2021-01 partition, this partition will be deleted.</p>
<p id="dli_02_0102__p4784134711164">If you set this parameter to <strong id="dli_02_0102__b5282142702511">true</strong>, DLI does not delete partitions before overwrite starts.</p>
</td>
</tr>
<tr id="dli_02_0102__row56403510234"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p106403522310">spark.sql.files.maxPartitionBytes</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p9640175112311">134217728</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p6640759237">Maximum number of bytes to be packed into a single partition when a file is read.</p>
</td>
</tr>
<tr id="dli_02_0102__row1364118532316"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p1641751235">spark.sql.badRecordsPath</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p206411656232">-</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p46411552315">Path of bad records.</p>
</td>
</tr>
<tr id="dli_02_0102__row5844161611018"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p10133536151012">dli.sql.sqlasync.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p213318364108">true</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p13134236121018">Indicates whether DDL and DCL statements are executed asynchronously. The value <span class="parmvalue" id="dli_02_0102__parmvalue97623141853"><b>true</b></span> indicates that asynchronous execution is enabled.</p>
</td>
</tr>
<tr id="dli_02_0102__row12507743111016"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p350815439108">dli.sql.job.timeout</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p850814351015">-</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p10508043181014">Sets the job running timeout interval. If the timeout interval expires, the job is canceled. Unit: second</p>
</td>
</tr>
<tr id="dli_02_0102__row116752522392"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p7482420111410">spark.sql.legacy.correlated.scalar.query.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p13482182011146">false</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><ul id="dli_02_0102__ul7267453172510"><li id="dli_02_0102__li10267165317259"><strong id="dli_02_0102__b18350221114">If set to true:</strong><ul id="dli_02_0102__ul174613114264"><li id="dli_02_0102__li1371018942617">When there is no duplicate data in a subquery, executing a correlated subquery does not require deduplication from the subquery's result.</li><li id="dli_02_0102__li57111692267">If there is duplicate data in a subquery, executing a correlated subquery will result in an error. To resolve this, the subquery's result must be deduplicated using functions such as <strong id="dli_02_0102__b65104717116">max()</strong> or <strong id="dli_02_0102__b14511127121110">min()</strong>.</li></ul>
</li><li id="dli_02_0102__li1721917199267"><strong id="dli_02_0102__b13717092114">If set to false:</strong><p id="dli_02_0102__p20789835122715">Regardless of whether there is duplicate data in a subquery, executing a correlated subquery requires deduplicating the subquery's result using functions such as <strong id="dli_02_0102__b1345311111114">max()</strong> or <strong id="dli_02_0102__b193451311171120">min()</strong>. Otherwise, an error will occur.</p>
</li></ul>
</td>
</tr>
<tr id="dli_02_0102__row15704182012241"><td class="cellrowborder" valign="top" width="29.43%" headers="mcps1.3.3.3.2.4.1.1 "><p id="dli_02_0102__p2013525463013">spark.sql.optimizer.dynamicPartitionPruning.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="15.83%" headers="mcps1.3.3.3.2.4.1.2 "><p id="dli_02_0102__p1135854183018">true</p>
</td>
<td class="cellrowborder" valign="top" width="54.74%" headers="mcps1.3.3.3.2.4.1.3 "><p id="dli_02_0102__p0120112114312">This parameter is used to control whether to enable dynamic partition pruning. Dynamic partition pruning can help reduce the amount of data that needs to be scanned and improve query performance when executing SQL queries.</p>
<ul id="dli_02_0102__ul10431123219399"><li id="dli_02_0102__li34312325392">When set to <strong id="dli_02_0102__b680142445310">true</strong>, dynamic partition pruning is enabled. SQL automatically detects and deletes partitions that do not meet the WHERE clause conditions during query. This is useful for tables that have a large number of partitions.</li><li id="dli_02_0102__li18431163263919">If SQL queries contain a large number of nested left join operations and the table has a large number of dynamic partitions, a large number of memory resources may be consumed during data parsing. As a result, the memory of the driver node is insufficient and there are frequent Full GCs.<p id="dli_02_0102__p9628429134018"><a name="dli_02_0102__li18431163263919"></a><a name="li18431163263919"></a>To avoid such issues, you can disable dynamic partition pruning by setting this parameter to <strong id="dli_02_0102__b2293123010538">false</strong>.</p>
<p id="dli_02_0102__p317112359398">However, disabling this optimization may reduce query performance. Once disabled, Spark does not automatically prune the partitions that do not meet the requirements.</p>
</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="dli_02_0102__table9391124139"></a><a name="table9391124139"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__table9391124139" frame="border" border="1" rules="all"><caption><b>Table 4 </b>tags parameters</caption><thead align="left"><tr id="dli_02_0102__row1440020130"><th align="left" class="cellrowborder" valign="top" width="14.899999999999999%" id="mcps1.3.3.4.2.5.1.1"><p id="dli_02_0102__p194012219139">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.83%" id="mcps1.3.3.4.2.5.1.2"><p id="dli_02_0102__p540724136">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.470000000000002%" id="mcps1.3.3.4.2.5.1.3"><p id="dli_02_0102__p840162161315">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.8%" id="mcps1.3.3.4.2.5.1.4"><p id="dli_02_0102__p16401271318">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__row194013231317"><td class="cellrowborder" valign="top" width="14.899999999999999%" headers="mcps1.3.3.4.2.5.1.1 "><p id="dli_02_0102__p13401329138">key</p>
</td>
<td class="cellrowborder" valign="top" width="10.83%" headers="mcps1.3.3.4.2.5.1.2 "><p id="dli_02_0102__p940102141313">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.470000000000002%" headers="mcps1.3.3.4.2.5.1.3 "><p id="dli_02_0102__p64019231317">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.8%" headers="mcps1.3.3.4.2.5.1.4 "><p id="dli_02_0102__p5401021139">Tag key</p>
<div class="note" id="dli_02_0102__note17482201612452"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dli_02_0102__dli_02_0194_p1448010306508">A tag key can contain a maximum of 128 characters. Only letters, numbers, spaces, and special characters (_.:+-@) are allowed, but the value cannot start or end with a space or start with <strong id="dli_02_0102__dli_02_0194_b815053114288">_sys_</strong>.</p>
</div></div>
</td>
</tr>
<tr id="dli_02_0102__row1141142181320"><td class="cellrowborder" valign="top" width="14.899999999999999%" headers="mcps1.3.3.4.2.5.1.1 "><p id="dli_02_0102__p164118215134">value</p>
</td>
<td class="cellrowborder" valign="top" width="10.83%" headers="mcps1.3.3.4.2.5.1.2 "><p id="dli_02_0102__p1141112181317">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.470000000000002%" headers="mcps1.3.3.4.2.5.1.3 "><p id="dli_02_0102__p174114281318">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.8%" headers="mcps1.3.3.4.2.5.1.4 "><div class="note" id="dli_02_0102__note1756317224458"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dli_02_0102__dli_02_0194_p4702194215507">A tag value can contain a maximum of 255 characters. Only letters, numbers, spaces, and special characters (_.:+-@) are allowed.</p>
</div></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0102__s04b3bd00c07846478613d3718f637112"><h4 class="sectiontitle">Response Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__en-us_topic_0069077806_table43107464" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Response parameters</caption><thead align="left"><tr id="dli_02_0102__en-us_topic_0069077806_row12322941"><th align="left" class="cellrowborder" valign="top" width="12.11%" id="mcps1.3.4.2.2.5.1.1"><p id="dli_02_0102__en-us_topic_0069077806_p17344522714">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.66%" id="mcps1.3.4.2.2.5.1.2"><p id="dli_02_0102__en-us_topic_0069077806_p3324582718">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.88%" id="mcps1.3.4.2.2.5.1.3"><p id="dli_02_0102__en-us_topic_0069077806_p1633452272">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="61.35%" id="mcps1.3.4.2.2.5.1.4"><p id="dli_02_0102__en-us_topic_0069077806_p18354562712">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__en-us_topic_0069077806_row42891778"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077806_p51681963">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077806_p25489436">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__en-us_topic_0069077806_p51378430">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__p4367201211150">Indicates whether the request is successfully sent. Value <span class="parmvalue" id="dli_02_0102__parmvalue156311828105312"><b>true</b></span> indicates that the request is successfully sent.</p>
</td>
</tr>
<tr id="dli_02_0102__en-us_topic_0069077806_row8129598"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077806_p54517712">message</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077806_p53858575">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__en-us_topic_0069077806_p468450">String</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__a4fa277540d3e42e48cec2027a36ca6bc">System prompt. If execution succeeds, the parameter setting may be left blank.</p>
</td>
</tr>
<tr id="dli_02_0102__en-us_topic_0069077806_row5956164"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077806_p12687257">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077806_p21034911">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__en-us_topic_0069077806_p26106237">String</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__en-us_topic_0069077806_p34230492">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.</p>
</td>
</tr>
<tr id="dli_02_0102__en-us_topic_0069077806_row39638980"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077806_p56640774">job_type</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077806_p24499997">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__en-us_topic_0069077806_p38342769">String</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__en-us_topic_0069077806_p18756585">Job type. The options include:</p>
<ul id="dli_02_0102__ud0cff9a09ee641b3a42e353020764dc1"><li id="dli_02_0102__l7d226b88efdd4fcf88d3788d27508a84"><strong id="dli_02_0102__b52571314202812">DDL</strong></li><li id="dli_02_0102__l80c96c9d7b9e4a79af85e21d2a84ffcc"><strong id="dli_02_0102__b934717178283">DCL</strong></li><li id="dli_02_0102__l5c09b32e40cb44d2817ad58d9a998f4a"><strong id="dli_02_0102__b128941419162815">IMPORT</strong></li><li id="dli_02_0102__l58fc4b78dd6c4ea198028097c40708a7"><strong id="dli_02_0102__b51751922162812">EXPORT</strong></li><li id="dli_02_0102__l18a0e5076c9d43068f0ccb1e8a0176b2"><strong id="dli_02_0102__b15831102422818">QUERY</strong></li><li id="dli_02_0102__l190ec97d1c504ae4bd4e74bc05b39330"><strong id="dli_02_0102__b8513142711285">INSERT</strong></li></ul>
</td>
</tr>
<tr id="dli_02_0102__row1822483371311"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__p18224933171318">schema</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__p92257338139">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__p1822514331138">Array of Map</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__p152251533161319">If the statement type is DDL, the column name and type of DDL are displayed.</p>
</td>
</tr>
<tr id="dli_02_0102__en-us_topic_0069077806_row34591542"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__en-us_topic_0069077806_p50451552">rows</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__en-us_topic_0069077806_p60043939">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__en-us_topic_0069077806_p31720870">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__en-us_topic_0069077806_p19253649">When the statement type is DDL and <strong id="dli_02_0102__b1831421712322">dli.sql.sqlasync.enabled</strong> is set to <strong id="dli_02_0102__b0401191919327">false</strong>, the execution results are returned directly. However, only a maximum of 1,000 rows can be returned.</p>
<p id="dli_02_0102__p84318153428">If there are more than 1,000 rows, obtain the results asynchronously. That is, when submitting the job, set <em id="dli_02_0102__i552575910815">xxxx</em> to <strong id="dli_02_0102__b124061445915">true</strong>, and then obtain the results from the job bucket configured by DLI. The path of the results on the job bucket can be obtained from the <strong id="dli_02_0102__b1393312366919">result_path</strong> in the return value of the ShowSqlJobStatus API. The full data of the results will be automatically exported to the job bucket.</p>
</td>
</tr>
<tr id="dli_02_0102__row0688520181920"><td class="cellrowborder" valign="top" width="12.11%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0102__p222905218240">job_mode</p>
</td>
<td class="cellrowborder" valign="top" width="9.66%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0102__p3229125212417">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0102__p922911524243">String</p>
</td>
<td class="cellrowborder" valign="top" width="61.35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0102__p4229105292420">Job execution mode. The options are as follows:</p>
<ul id="dli_02_0102__ul194411241202517"><li id="dli_02_0102__li16442124112518"><strong id="dli_02_0102__b1386564355617">async</strong>: asynchronous</li><li id="dli_02_0102__li2441252182510"><strong id="dli_02_0102__b266194415613">sync</strong>: synchronous</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0102__section10171194731415"><h4 class="sectiontitle">Example Request</h4><p id="dli_02_0102__p258671017141">Submit a SQL job. The job execution database and queue are <strong id="dli_02_0102__b6327184815917">db1</strong> and <strong id="dli_02_0102__b9433132414103">default</strong>, respectively. Then, add the tags <strong id="dli_02_0102__b169015273117">workspace=space1</strong> and <strong id="dli_02_0102__b56280378110">jobName=name1</strong> for the job.</p>
<pre class="screen" id="dli_02_0102__screen58732893165524">{
"currentdb": "db1",
"sql": "desc table1",
"queue_name": "default",
"conf": [
"dli.sql.shuffle.partitions = 200"
],
"tags": [
{
"key": "workspace",
"value": "space1"
},
{
"key": "jobName",
"value": "name1"
}
]
}</pre>
</div>
<div class="section" id="dli_02_0102__section57434560164325"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="dli_02_0102__screen44147025165546">{
"is_success": true,
"message": "",
"job_id": "8ecb0777-9c70-4529-9935-29ea0946039c",
"job_type": "DDL",
"job_mode":"sync",
"schema": [
{
"col_name": "string"
},
{
"data_type": "string"
},
{
"comment": "string"
}
],
"rows": [
[
"c1",
"int",
null
],
[
"c2",
"string",
null
]
]
}</pre>
</div>
<div class="section" id="dli_02_0102__sf39cfd445ad24e9e82754fcb0027179d"><h4 class="sectiontitle">Status Codes</h4><p id="dli_02_0102__a04144ca3a08e4576b386c6a98f43a2ae"><a href="#dli_02_0102__tb12870f1c5f24b27abd55ca24264af36">Table 6</a> describes the status codes.</p>
<div class="tablenoborder"><a name="dli_02_0102__tb12870f1c5f24b27abd55ca24264af36"></a><a name="tb12870f1c5f24b27abd55ca24264af36"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0102__tb12870f1c5f24b27abd55ca24264af36" frame="border" border="1" rules="all"><caption><b>Table 6 </b>Status codes</caption><thead align="left"><tr id="dli_02_0102__r8d54231f95b14c01a5e55e95f3b2e838"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.7.3.2.3.1.1"><p id="dli_02_0102__ab49d21f312644072a331f43e92baf853">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.7.3.2.3.1.2"><p id="dli_02_0102__aea1d3bd107bb4c499da79a88832d256c">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0102__r211ad4eb571d4d938e5579998723174e"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0102__a3153e07b3a9749adba92599fe6628fbf">200</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0102__p104431642124811">Submitted successfully.</p>
</td>
</tr>
<tr id="dli_02_0102__row44937531727"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0102__p184941532219">400</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0102__p2049413539219">Request error.</p>
</td>
</tr>
<tr id="dli_02_0102__row14726424133719"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0102__p4726182423719">500</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0102__p1726424103720">Internal service error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0102__section13596141025715"><h4 class="sectiontitle">Error Codes</h4><p id="dli_02_0102__p420584425712">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 <a href="dli_02_0056.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_02_0158.html">SQL Job-related APIs</a></div>
</div>
</div>