Yang, Tong 6182f91ba8 MRS component operation guide_normal 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2022-12-09 14:55:21 +00:00

42 lines
3.7 KiB
HTML

<a name="mrs_01_0586"></a><a name="mrs_01_0586"></a>
<h1 class="topictitle1">Inserting Data to the OpenTSDB Table</h1>
<div id="body1589421621260"><div class="section" id="mrs_01_0586__section2167437125214"><h4 class="sectiontitle">Function</h4><p id="mrs_01_0586__p423814375525">Run the <strong id="mrs_01_0586__b136279531419">INSERT INTO</strong> statement to insert the data in the table to the associated OpenTSDB metric.</p>
</div>
<div class="section" id="mrs_01_0586__section41681537155216"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="mrs_01_0586__screen1840611813411">INSERT INTO TABLE_NAME SELECT * FROM SRC_TABLE;
INSERT INTO TABLE_NAME VALUES(XXX);</pre>
</div>
<div class="section" id="mrs_01_0586__section5170183716527"><h4 class="sectiontitle">Keyword</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_0586__table1817193710524" frame="border" border="1" rules="all"><thead align="left"><tr id="mrs_01_0586__row42382375527"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.3.2.1.3.1.1"><p id="mrs_01_0586__p1423823745220"><strong id="mrs_01_0586__b22381637155219">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.3.2.1.3.1.2"><p id="mrs_01_0586__p18239537115218"><strong id="mrs_01_0586__b10239203715219">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_0586__row323913745210"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.3.1.1 "><p id="mrs_01_0586__p15239133735214">TABLE_NAME</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.3.1.2 "><p id="mrs_01_0586__p1523993745219">Indicates the name of the associated OpenTSDB table.</p>
</td>
</tr>
<tr id="mrs_01_0586__row2239837105215"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.3.2.1.3.1.1 "><p id="mrs_01_0586__p11239153785212">SRC_TABLE</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.3.2.1.3.1.2 "><p id="mrs_01_0586__p7239103765217">Indicates the name of the table from which data is obtained. This parameter can be set to a name of a common table.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_01_0586__section13175153785212"><h4 class="sectiontitle">Precautions</h4><ul id="mrs_01_0586__ul16239173725216"><li id="mrs_01_0586__li2239203712527">The inserted data cannot be <strong id="mrs_01_0586__b2096917242034">null</strong>. If the inserted data is the same as the original data or only the <strong id="mrs_01_0586__b9975122418310">value</strong> is different, the inserted data overwrites the original data.</li><li id="mrs_01_0586__li02392379523"><strong id="mrs_01_0586__b13977376310">INSERT OVERWRITE</strong> is not supported.</li><li id="mrs_01_0586__li19239113785217">You are advised not to concurrently insert data into a table. If you concurrently insert data into a table, there is a possibility that conflicts occur, leading to data insertion failures.</li><li id="mrs_01_0586__li72391237185211">The <strong id="mrs_01_0586__b22501511417">TIMESTAMP</strong> format supports only yyyy-MM-dd hh:mm:ss.</li></ul>
</div>
<div class="section" id="mrs_01_0586__section7179937145212"><h4 class="sectiontitle">Example</h4><p id="mrs_01_0586__p10279646193617">Insert data into table <strong id="mrs_01_0586__b747171512416">opentsdb_table</strong>.</p>
<pre class="screen" id="mrs_01_0586__screen1713317311412">insert into opentsdb_table values('<span id="mrs_01_0586__ph25148716491">city1</span>','futian','2018-05-03 00:00:00',21);</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0584.html">Interconnecting Spark with OpenTSDB</a></div>
</div>
</div>