Files
doc-exports/docs/dli/api-ref/dli_02_0312.html
Su, Xiaomeng 04ae6632a7 dli_api_20250929
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>
2026-01-19 08:09:55 +00:00

231 lines
19 KiB
HTML

<a name="dli_02_0312"></a><a name="dli_02_0312"></a>
<h1 class="topictitle1">Previewing SQL Job Query Results</h1>
<div id="body1603092254081"><div class="section" id="dli_02_0312__s25c520608f924620832c60c39296fb4f"><h4 class="sectiontitle">Function</h4><p id="dli_02_0312__en-us_topic_0069077812_p26681534">This API is used to view the job execution result after a job is executed using SQL query statements. Currently, you can only query execution results of jobs of the <strong id="dli_02_0312__b84235270615821_1">QUERY</strong> type.</p>
<p id="dli_02_0312__p398101411189">This API can be used to view only the first 1000 result records and does not support pagination query. To view all query results, you need to export the query results first. For details, see <a href="dli_02_0024.html">Exporting Query Results</a>.</p>
</div>
<div class="section" id="dli_02_0312__s46248c92bcac4e63baf217574b85b423"><h4 class="sectiontitle">URI</h4><ul id="dli_02_0312__ul6318248165914"><li id="dli_02_0312__li11318648165918">URI format<p id="dli_02_0312__p11826105012711"><a name="dli_02_0312__li11318648165918"></a><a name="li11318648165918"></a>GET /v1.0/{project_id}/jobs/{job_id}/preview</p>
</li></ul>
<ul id="dli_02_0312__ul13337461105"><li id="dli_02_0312__li033713611016">Parameter descriptions
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0312__table18337867015" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameters</caption><thead align="left"><tr id="dli_02_0312__row2334162017"><th align="left" class="cellrowborder" valign="top" width="16.919999999999998%" id="mcps1.3.2.3.1.1.2.5.1.1"><p id="dli_02_0312__p19334261015">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.23%" id="mcps1.3.2.3.1.1.2.5.1.2"><p id="dli_02_0312__p6334861108">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.479999999999999%" id="mcps1.3.2.3.1.1.2.5.1.3"><p id="dli_02_0312__p17119637183714">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="60.370000000000005%" id="mcps1.3.2.3.1.1.2.5.1.4"><p id="dli_02_0312__p8334268015">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0312__row7929145544017"><td class="cellrowborder" valign="top" width="16.919999999999998%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="dli_02_0312__en-us_topic_0069077803_p43412436">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="10.23%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="dli_02_0312__en-us_topic_0069077803_p26746391">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.479999999999999%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="dli_02_0312__p3119183723712">String</p>
</td>
<td class="cellrowborder" valign="top" width="60.370000000000005%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="dli_02_0312__p1310472724012">Project ID, which is used for resource isolation. For how to obtain a project ID, see <a href="dli_02_0183.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="dli_02_0312__row73351761701"><td class="cellrowborder" valign="top" width="16.919999999999998%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="dli_02_0312__p173340614018">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="10.23%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="dli_02_0312__p123344611019">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.479999999999999%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="dli_02_0312__p9120113716371">String</p>
</td>
<td class="cellrowborder" valign="top" width="60.370000000000005%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="dli_02_0312__p20335106301">Job ID</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0312__table1701101045811" frame="border" border="1" rules="all"><caption><b>Table 2 </b>query parameter descriptions</caption><thead align="left"><tr id="dli_02_0312__row77021110185813"><th align="left" class="cellrowborder" valign="top" width="16.919999999999998%" id="mcps1.3.2.3.1.2.2.5.1.1"><p id="dli_02_0312__p270214100585">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.57%" id="mcps1.3.2.3.1.2.2.5.1.2"><p id="dli_02_0312__p177021410155813">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.469999999999999%" id="mcps1.3.2.3.1.2.2.5.1.3"><p id="dli_02_0312__p57021110145813">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.04%" id="mcps1.3.2.3.1.2.2.5.1.4"><p id="dli_02_0312__p16702111012588">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0312__row11703131011581"><td class="cellrowborder" valign="top" width="16.919999999999998%" headers="mcps1.3.2.3.1.2.2.5.1.1 "><p id="dli_02_0312__p17031610195820">page-size</p>
</td>
<td class="cellrowborder" valign="top" width="12.57%" headers="mcps1.3.2.3.1.2.2.5.1.2 "><p id="dli_02_0312__p2703171065815">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.469999999999999%" headers="mcps1.3.2.3.1.2.2.5.1.3 "><p id="dli_02_0312__p1670331015817">Long</p>
</td>
<td class="cellrowborder" valign="top" width="56.04%" headers="mcps1.3.2.3.1.2.2.5.1.4 "><p id="dli_02_0312__p18703201015818">Number of result rows. The value ranges from 1 to 1000. The default rate limit is <strong id="dli_02_0312__b838765611158">1000</strong>.</p>
</td>
</tr>
<tr id="dli_02_0312__row1870315109586"><td class="cellrowborder" valign="top" width="16.919999999999998%" headers="mcps1.3.2.3.1.2.2.5.1.1 "><p id="dli_02_0312__p177041210165813">queue-name</p>
</td>
<td class="cellrowborder" valign="top" width="12.57%" headers="mcps1.3.2.3.1.2.2.5.1.2 "><p id="dli_02_0312__p1370481065811">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.469999999999999%" headers="mcps1.3.2.3.1.2.2.5.1.3 "><p id="dli_02_0312__p1970416109587">String</p>
</td>
<td class="cellrowborder" valign="top" width="56.04%" headers="mcps1.3.2.3.1.2.2.5.1.4 "><p id="dli_02_0312__p470410107589">Name of the execution queue for obtaining job results. If this parameter is not specified, the default system queue is used.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="dli_02_0312__note5399014125910"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_02_0312__p14041414115911">The following is an example of the URL containing the <strong id="dli_02_0312__b15294154755112">query</strong> parameter:</p>
<p id="dli_02_0312__p54546346590">GET /v1.0/{project_id}/jobs/{job_id}/preview?page-size=<i><span class="varname" id="dli_02_0312__varname1230820412019">{size}</span></i>&amp;queue-name=<i><span class="varname" id="dli_02_0312__varname8308841507">{queue_name}</span></i></p>
</div></div>
</li></ul>
</div>
<div class="section" id="dli_02_0312__se4ec083d06454f1d82589db5de2c43cc"><h4 class="sectiontitle">Request Parameters</h4><p id="dli_02_0312__p53552175145939">None</p>
</div>
<div class="section" id="dli_02_0312__s26e44e4c19ae431ab7d5d8758c986eb8"><h4 class="sectiontitle">Response Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0312__table1175762563013" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Response parameters</caption><thead align="left"><tr id="dli_02_0312__row17758142518307"><th align="left" class="cellrowborder" valign="top" width="14.55145514551455%" id="mcps1.3.4.2.2.5.1.1"><p id="dli_02_0312__p727713523308">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.061106110611062%" id="mcps1.3.4.2.2.5.1.2"><p id="dli_02_0312__p7363240460">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.881688168816883%" id="mcps1.3.4.2.2.5.1.3"><p id="dli_02_0312__p171211130123515">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.505750575057505%" id="mcps1.3.4.2.2.5.1.4"><p id="dli_02_0312__p112771852113019">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0312__row1175852593012"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p375822523018">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p73631845467">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p3812181519518">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p862011251763">Whether the request is successfully executed. <strong id="dli_02_0312__b6177102319251">true</strong> indicates that the request is successfully executed.</p>
</td>
</tr>
<tr id="dli_02_0312__row1875812533016"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p975882514303">message</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p163631243463">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p18813715254">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__a9a27f692c352434fbfde0c951e23503b">System prompt. If the execution succeeds, this parameter may be left blank.</p>
</td>
</tr>
<tr id="dli_02_0312__row147582025103017"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p5758132513309">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p1936319416466">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p48139153518">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p19620152516611">Job ID You can get the value by calling <a href="dli_02_0102.html">Submitting a SQL Job (Recommended)</a>.</p>
</td>
</tr>
<tr id="dli_02_0312__row57581125183017"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p1975812254301">job_type</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p136394104616">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p168137152053">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p19547103314618">Job type. Options: <strong id="dli_02_0312__b75581446101616">DDL</strong>, <strong id="dli_02_0312__b175631146171619">DCL</strong>, <strong id="dli_02_0312__b6563184651612">IMPORT</strong>, <strong id="dli_02_0312__b556317460168">EXPORT</strong>, <strong id="dli_02_0312__b1756318460169">QUERY</strong>, <strong id="dli_02_0312__b15641146121611">INSERT</strong>, <strong id="dli_02_0312__b115641546121617">DATA_MIGRATION</strong>, <strong id="dli_02_0312__b9564746181610">UPDATE</strong>, <strong id="dli_02_0312__b256434601612">DELETE</strong>, <strong id="dli_02_0312__b105645462161">RESTART_QUEUE</strong> and <strong id="dli_02_0312__b4565164661619">SCALE_QUEUE</strong>.</p>
<p id="dli_02_0312__p263831915266">Currently, you can only query execution results of jobs of the <strong id="dli_02_0312__b1398641187">QUERY</strong> type.</p>
<ul id="dli_02_0312__ul741772872214"><li id="dli_02_0312__li1041882862219"><strong id="dli_02_0312__b5393185519544">DDL</strong>: jobs that create, modify, and delete metadata files</li><li id="dli_02_0312__li1141852813224"><strong id="dli_02_0312__b13484209125517">DCL</strong>: jobs that grant and revoke permissions<p id="dli_02_0312__p16270111416276">When <strong id="dli_02_0312__b5430111275512">job_type</strong> is set to <strong id="dli_02_0312__b343012122552">DCL</strong>, the operation is synchronous.</p>
</li><li id="dli_02_0312__li154182028132213"><strong id="dli_02_0312__b137720134551">IMPORT</strong>: jobs that import external data into the database</li><li id="dli_02_0312__li11418142812219"><strong id="dli_02_0312__b166953157557">EXPORT</strong>: jobs that export data to an external database</li><li id="dli_02_0312__li6418028112217"><strong id="dli_02_0312__b192141517155512">QUERY</strong>: jobs that run query statements</li><li id="dli_02_0312__li1541842852212"><strong id="dli_02_0312__b1305131885510">INSERT</strong>: jobs that add new data to tables</li><li id="dli_02_0312__li1891825716295"><strong id="dli_02_0312__b69662516551">DATA_MIGRATION</strong>: data migration jobs</li><li id="dli_02_0312__li2406771309"><strong id="dli_02_0312__b123113205514">UPDATE</strong>: jobs that update table data</li><li id="dli_02_0312__li1773151413308"><strong id="dli_02_0312__b2039511385558">DELETE</strong>: jobs that delete data from tables</li><li id="dli_02_0312__li57851819143013"><strong id="dli_02_0312__b325124611551">RESTART_QUEUE</strong>: jobs that restart specified queues</li><li id="dli_02_0312__li57418251309"><strong id="dli_02_0312__b128381653155511">SCALE_QUEUE</strong>: jobs that scale in or out specified queues</li></ul>
</td>
</tr>
<tr id="dli_02_0312__row8145205326"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p015520103215">row_count</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p4363134184610">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p48131815251">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p14151820183218">Total number of job results.</p>
</td>
</tr>
<tr id="dli_02_0312__row10990152253217"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p19901122113216">input_size</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p53631546466">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p94349351478">Long</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p119901622103210">Amount of data scanned during job execution.</p>
</td>
</tr>
<tr id="dli_02_0312__row8419638163220"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p541923816325">schema</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p4363104134612">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p27869361976">Array of Map</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p20419143820327">Name and type of the job result column.</p>
</td>
</tr>
<tr id="dli_02_0312__row13066311577"><td class="cellrowborder" valign="top" width="14.55145514551455%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0312__p667317416715">rows</p>
</td>
<td class="cellrowborder" valign="top" width="11.061106110611062%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0312__p173631042463">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0312__p378683612717">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="57.505750575057505%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0312__p93071431874">Job results set.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0312__section1267554313159"><h4 class="sectiontitle">Example Request</h4><p id="dli_02_0312__p16826101012164">None</p>
</div>
<div class="section" id="dli_02_0312__section3290817714576"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="dli_02_0312__screen48007537145823">{
"is_success": true,
"message": "",
"job_id": "ead0b276-8ed4-4eb5-b520-58f1511e7033",
"job_type": "QUERY",
"row_count": 1,
"input_size": 74,
"schema": [
<em id="dli_02_0312__i324801163415">{</em>
"c1": "int"
},
{
"c2": "string"
}
],
"rows": [
[
23,
"sda"
]
]
}</pre>
</div>
<div class="section" id="dli_02_0312__sf39cfd445ad24e9e82754fcb0027179d"><h4 class="sectiontitle">Status Codes</h4><p id="dli_02_0312__a04144ca3a08e4576b386c6a98f43a2ae"><a href="#dli_02_0312__tb12870f1c5f24b27abd55ca24264af36">Table 4</a> describes status codes.</p>
<div class="tablenoborder"><a name="dli_02_0312__tb12870f1c5f24b27abd55ca24264af36"></a><a name="tb12870f1c5f24b27abd55ca24264af36"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0312__tb12870f1c5f24b27abd55ca24264af36" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Status codes</caption><thead align="left"><tr id="dli_02_0312__r8d54231f95b14c01a5e55e95f3b2e838"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.7.3.2.3.1.1"><p id="dli_02_0312__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_0312__aea1d3bd107bb4c499da79a88832d256c">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0312__r211ad4eb571d4d938e5579998723174e"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0312__a3153e07b3a9749adba92599fe6628fbf">200</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0312__p104431642124811">The query is successful.</p>
</td>
</tr>
<tr id="dli_02_0312__row44937531727"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0312__p184941532219">400</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0312__p2049413539219">Request error.</p>
</td>
</tr>
<tr id="dli_02_0312__row65331212142411"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0312__p5537171216249">500</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0312__p953813124249">Internal server error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0312__section13596141025715"><h4 class="sectiontitle">Error Codes</h4><p id="dli_02_0312__p420584425712">If an error occurs when this API is called, the system does not return the result similar to the preceding example, but returns an error code and error message. 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>