Files
doc-exports/docs/dli/umn/dli_01_0021.html
Su, Xiaomeng b8dbeabef4 dli_umn_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>
2025-11-26 09:25:57 +00:00

69 lines
11 KiB
HTML

<a name="dli_01_0021"></a><a name="dli_01_0021"></a>
<h1 class="topictitle1">Creating a SQL Job Template</h1>
<div id="body1501038213757"><p id="dli_01_0021__p60316341134840">DLI allows you to create custom templates or save currently used SQL statements as templates for quick and convenient SQL operations. Once a template is saved, you can execute SQL operations directly through the template without the need to write SQL statements.</p>
<p id="dli_01_0021__p9291154524111">SQL templates include sample templates and custom templates. The default sample template contains 22 standard TPC-H query statements, which can meet most TPC-H test requirements. For details, see <a href="dli_01_05111.html">TPC-H Sample Data in the SQL Templates Preset on DLI</a>.</p>
<div class="note" id="dli_01_0021__note1596214331554"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_01_0021__p810457114113">In the navigation pane on the left, choose <strong id="dli_01_0021__b13947911195216">Job Templates</strong> &gt; <strong id="dli_01_0021__b2097633115114">SQL Templates</strong>. In the upper right corner of the displayed page, click <strong id="dli_01_0021__b49761731205111">Settings</strong>. In the displayed <strong id="dli_01_0021__b2094413205519">Settings</strong> dialog box, choose whether to display templates by group.</p>
<p id="dli_01_0021__p20101557204111">If you enable <strong id="dli_01_0021__b228574605417">Display by Group</strong>, the display options are <strong id="dli_01_0021__b2325122865811">Expand the first group</strong>, <strong id="dli_01_0021__b3489103475813">Expand all</strong>, and <strong id="dli_01_0021__b1240773817582">Collapse all</strong>.</p>
</div></div>
<div class="section" id="dli_01_0021__section73391334165211"><h4 class="sectiontitle">Creating a SQL Job Template</h4><p id="dli_01_0021__p1499386269">You can create a template on either the <span class="wintitle" id="dli_01_0021__wintitle1110695211279"><b>Job Templates</b></span> or the <span class="wintitle" id="dli_01_0021__wintitle17106205212720"><b>SQL Editor</b></span> page.</p>
<ul id="dli_01_0021__ul161981531193516"><li id="dli_01_0021__li6067656217264">To create a template on the <span class="wintitle" id="dli_01_0021__wintitle46974877161025"><b>Job Templates</b></span> page:<ol id="dli_01_0021__ol46612018172655"><li id="dli_01_0021__li28223746172655">On the left of the management console, choose <span class="uicontrol" id="dli_01_0021__uicontrol64691210181112"><b>Job Templates</b></span> &gt; <span class="uicontrol" id="dli_01_0021__uicontrol1514111187110"><b>SQL Templates</b></span>.</li><li id="dli_01_0021__li12412519172825">On the <span class="wintitle" id="dli_01_0021__wintitle3223730153419"><b>SQL Templates</b></span> page, click <strong id="dli_01_0021__b8940123818383">Create Template</strong> to create a template.<p id="dli_01_0021__p18646132611325">Enter the template name, SQL statement, and description information. For details, see <a href="#dli_01_0021__table8760202135313">Table 1</a>.</p>
<div class="tablenoborder"><a name="dli_01_0021__table8760202135313"></a><a name="table8760202135313"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_01_0021__table8760202135313" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter descriptions</caption><thead align="left"><tr id="dli_01_0021__row1175916216534"><th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.4.3.1.2.2.4.2.3.1.1"><p id="dli_01_0021__p11759202116537">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="79%" id="mcps1.3.4.3.1.2.2.4.2.3.1.2"><p id="dli_01_0021__p1575912112538">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_01_0021__row1776092113537"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.1 "><p id="dli_01_0021__p14760132114535">Name</p>
</td>
<td class="cellrowborder" valign="top" width="79%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.2 "><p id="dli_01_0021__p14760162111532">Indicates the template name.</p>
<ul id="dli_01_0021__ul176014214537"><li id="dli_01_0021__li97601721105311">A template name can contain only digits, letters, and underscores (_), but cannot start with an underscore (_) or contain only digits. It cannot be left empty.</li><li id="dli_01_0021__li47603216538">The template name can contain a maximum of 50 characters.</li></ul>
</td>
</tr>
<tr id="dli_01_0021__row1921112512330"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.1 "><p id="dli_01_0021__p721117573312">Statement</p>
</td>
<td class="cellrowborder" valign="top" width="79%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.2 "><p id="dli_01_0021__p162121450334">SQL statement to be saved as a template.</p>
</td>
</tr>
<tr id="dli_01_0021__row8760122115310"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.1 "><p id="dli_01_0021__p6760162175317">Description</p>
</td>
<td class="cellrowborder" valign="top" width="79%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.2 "><p id="dli_01_0021__p13760102118531">Description of the template you create.</p>
</td>
</tr>
<tr id="dli_01_0021__row18481020155119"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.1 "><p id="dli_01_0021__p684972045112">Group</p>
</td>
<td class="cellrowborder" valign="top" width="79%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.2 "><ul id="dli_01_0021__ul187917655212"><li id="dli_01_0021__li1879117610520">Use existing</li><li id="dli_01_0021__li114864209520">Use new</li><li id="dli_01_0021__li2358123015219">Do not use</li></ul>
</td>
</tr>
<tr id="dli_01_0021__row1084922017517"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.1 "><p id="dli_01_0021__p1184952015113">Group Name</p>
</td>
<td class="cellrowborder" valign="top" width="79%" headers="mcps1.3.4.3.1.2.2.4.2.3.1.2 "><p id="dli_01_0021__p15849720175114">If you select <strong id="dli_01_0021__b11234933143711">Use existing</strong> or <strong id="dli_01_0021__b4423633714">Use new</strong>, you need to enter the group name.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="dli_01_0021__li35735299174815">Click <span class="uicontrol" id="dli_01_0021__uicontrol13046325161025"><b>OK</b></span>.</li></ol>
</li><li id="dli_01_0021__li111017453617">To create a template on the <span class="wintitle" id="dli_01_0021__wintitle165181318181712"><b>SQL Editor</b></span> page:<ol id="dli_01_0021__ol1143561622714"><li id="dli_01_0021__li94360167274">On the left of the management console, click <span class="uicontrol" id="dli_01_0021__uicontrol19127193671113"><b>SQL Editor</b></span>.</li><li id="dli_01_0021__li12760202135317">In the SQL job editing area of the displayed <strong id="dli_01_0021__b895062282912">SQL Editor</strong> page, click <strong id="dli_01_0021__b1950722102916">More</strong> in the upper right corner and choose <strong id="dli_01_0021__b1495118225297">Save as Template</strong>.<p id="dli_01_0021__p6760221175316">Enter the template name, SQL statement, and description information. For details, see <a href="#dli_01_0021__table8760202135313">Table 1</a>.</p>
</li><li id="dli_01_0021__li194511516172713">Click <span class="uicontrol" id="dli_01_0021__uicontrol26574819161025"><b>OK</b></span>.</li></ol>
</li></ul>
</div>
<div class="section" id="dli_01_0021__section1936164995213"><h4 class="sectiontitle">Submitting a SQL Job Using a Template</h4><div class="p" id="dli_01_0021__p1670225883315">Perform the template operation as follows:<ol id="dli_01_0021__ol633343983818"><li id="dli_01_0021__li28883252183527">On the left of the management console, choose <span class="uicontrol" id="dli_01_0021__uicontrol1997117241314"><b>Job Templates</b></span> &gt; <span class="uicontrol" id="dli_01_0021__uicontrol889719741310"><b>SQL Templates</b></span>.</li><li id="dli_01_0021__li19089271183613">On the <span class="wintitle" id="dli_01_0021__wintitle0766162818416"><b>SQL Templates</b></span> page, select a template and click <span class="uicontrol" id="dli_01_0021__uicontrol5961123084218"><b>Execute</b></span> in the <span class="parmname" id="dli_01_0021__parmname1383215974217"><b>Operation</b></span> column. The <span class="wintitle" id="dli_01_0021__wintitle6260112433"><b>SQL Editor</b></span> page is displayed, and the corresponding SQL statement is automatically entered in the SQL job editing window.</li><li id="dli_01_0021__li23348397388">In the upper right corner of the SQL job editing window, Click <strong id="dli_01_0021__b224245462">Execute</strong> to run the SQL statement. After the execution is complete, you can view the execution result below the current SQL job editing window.</li></ol>
</div>
</div>
<div class="section" id="dli_01_0021__section1045610354536"><h4 class="sectiontitle">Searching for a SQL Job Template</h4><p id="dli_01_0021__p1320034413539">On the <span class="wintitle" id="dli_01_0021__wintitle15514703125032"><b>SQL Templates</b></span> page, you can enter the template name keyword in the search box on the upper right corner to search for the desired template.</p>
</div>
<div class="section" id="dli_01_0021__section08698165316"><h4 class="sectiontitle">Modifying a SQL Job Template</h4><p id="dli_01_0021__p09831626155213">Only custom templates can be modified. To modify a template, perform the following steps:</p>
<ol id="dli_01_0021__ol65311575141654"><li id="dli_01_0021__li11363555141654"><span>On the <span class="wintitle" id="dli_01_0021__wintitle24033288498"><b>SQL Templates</b></span> page, locate the target template and click <span class="uicontrol" id="dli_01_0021__uicontrol19409142815496"><b>Modify</b></span> in the <span class="parmname" id="dli_01_0021__parmname2409428104916"><b>Operation</b></span> column.</span></li><li id="dli_01_0021__li64359479141658"><span>In the displayed <span class="wintitle" id="dli_01_0021__wintitle66251129155318"><b>Modify Template</b></span> dialog box, modify the template name, statement, and description as required.</span></li><li id="dli_01_0021__li33371888141815"><span>Click <span class="uicontrol" id="dli_01_0021__uicontrol39760151161025"><b>OK</b></span>.</span></li></ol>
</div>
<div class="section" id="dli_01_0021__section1317681345320"><h4 class="sectiontitle">Deleting a Template</h4><p id="dli_01_0021__p2055311612534">On the <span class="wintitle" id="dli_01_0021__wintitle2073211312491"><b>SQL Templates</b></span> page, select one or more templates to be deleted and click <strong id="dli_01_0021__b8732153112493">Delete</strong> to delete the selected templates.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_01_05110.html">Creating and Managing SQL Job Templates</a></div>
</div>
</div>