| import{_ as i,c as r,d as e,b as o,e as a,a as t,f as l,r as p,o as d}from"./app-C8175JBb.js";const c={};function u(m,s){const n=p("RouteLink");return d(),r("div",null,[s[43]||(s[43]=e("h1",{id:"write-data",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#write-data"},[e("span",null,"Write Data")])],-1)),s[44]||(s[44]=e("h2",{id:"_1-cli-insert",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-cli-insert"},[e("span",null,"1. CLI INSERT")])],-1)),e("p",null,[s[4]||(s[4]=a("IoTDB provides users with a variety of ways to insert real-time data, such as directly inputting ")),t(n,{to:"/UserGuide/latest/SQL-Manual/SQL-Manual.html#insert-data"},{default:l(()=>s[0]||(s[0]=[a("INSERT SQL statement")])),_:1}),s[5]||(s[5]=a(" in ")),t(n,{to:"/UserGuide/latest/Tools-System/CLI.html"},{default:l(()=>s[1]||(s[1]=[a("Client/Shell tools")])),_:1}),s[6]||(s[6]=a(", or using ")),t(n,{to:"/UserGuide/latest/API/Programming-JDBC.html"},{default:l(()=>s[2]||(s[2]=[a("Java JDBC")])),_:1}),s[7]||(s[7]=a(" to perform single or batch execution of ")),t(n,{to:"/UserGuide/latest/SQL-Manual/SQL-Manual.html"},{default:l(()=>s[3]||(s[3]=[a("INSERT SQL statement")])),_:1}),s[8]||(s[8]=a("."))]),e("p",null,[s[10]||(s[10]=a("NOTE: This section mainly introduces the use of ")),t(n,{to:"/UserGuide/latest/SQL-Manual/SQL-Manual.html#insert-data"},{default:l(()=>s[9]||(s[9]=[a("INSERT SQL statement")])),_:1}),s[11]||(s[11]=a(" for real-time data import in the scenario."))]),s[45]||(s[45]=e("p",null,"Writing a repeat timestamp covers the original timestamp data, which can be regarded as updated data.",-1)),s[46]||(s[46]=e("h3",{id:"_1-1-use-of-insert-statements",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_1-1-use-of-insert-statements"},[e("span",null,"1.1 Use of INSERT Statements")])],-1)),e("p",null,[s[15]||(s[15]=a("The ")),t(n,{to:"/UserGuide/latest/SQL-Manual/SQL-Manual.html#insert-data"},{default:l(()=>s[12]||(s[12]=[a("INSERT SQL statement")])),_:1}),s[16]||(s[16]=a(" statement is used to insert data into one or more specified timeseries created. For each point of data inserted, it consists of a ")),t(n,{to:"/UserGuide/latest/Basic-Concept/Operate-Metadata.html"},{default:l(()=>s[13]||(s[13]=[a("timestamp")])),_:1}),s[17]||(s[17]=a(" and a sensor acquisition value (see ")),t(n,{to:"/UserGuide/latest/Background-knowledge/Data-Type.html"},{default:l(()=>s[14]||(s[14]=[a("Data Type")])),_:1}),s[18]||(s[18]=a(")."))]),s[47]||(s[47]=o(`<p>In the scenario of this section, take two timeseries <code>root.ln.wf02.wt02.status</code> and <code>root.ln.wf02.wt02.hardware</code> as an example, and their data types are BOOLEAN and TEXT, respectively.</p><p>The sample code for single column data insertion is as follows:</p><div class="language- line-numbers-mode" data-highlighter="shiki" data-ext="" data-title="" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span>IoTDB > insert into root.ln.wf02.wt02(timestamp,status) values(1,true)</span></span> |
| <span class="line"><span>IoTDB > insert into root.ln.wf02.wt02(timestamp,hardware) values(1, 'v1')</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div></div></div><p>The above example code inserts the long integer timestamp and the value "true" into the timeseries <code>root.ln.wf02.wt02.status</code> and inserts the long integer timestamp and the value "v1" into the timeseries <code>root.ln.wf02.wt02.hardware</code>. When the execution is successful, cost time is shown to indicate that the data insertion has been completed.</p><blockquote><p>Note: In IoTDB, TEXT type data can be represented by single and double quotation marks. The insertion statement above uses double quotation marks for TEXT type data. The following example will use single quotation marks for TEXT type data.</p></blockquote><p>The INSERT statement can also support the insertion of multi-column data at the same time point. The sample code of inserting the values of the two timeseries at the same time point '2' is as follows:</p><div class="language-sql line-numbers-mode" data-highlighter="shiki" data-ext="sql" data-title="sql" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> insert into</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">ln</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wf02</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wt02</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">timestamp</span><span style="color:#ABB2BF;">, </span><span style="color:#C678DD;">status</span><span style="color:#ABB2BF;">, hardware) </span><span style="color:#C678DD;">VALUES</span><span style="color:#ABB2BF;"> (</span><span style="color:#D19A66;">2</span><span style="color:#ABB2BF;">, false, </span><span style="color:#98C379;">'v2'</span><span style="color:#ABB2BF;">)</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>In addition, The INSERT statement support insert multi-rows at once. The sample code of inserting two rows as follows:</p><div class="language-sql line-numbers-mode" data-highlighter="shiki" data-ext="sql" data-title="sql" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> insert into</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">ln</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wf02</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wt02</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">timestamp</span><span style="color:#ABB2BF;">, </span><span style="color:#C678DD;">status</span><span style="color:#ABB2BF;">, hardware) </span><span style="color:#C678DD;">VALUES</span><span style="color:#ABB2BF;"> (</span><span style="color:#D19A66;">3</span><span style="color:#ABB2BF;">, false, </span><span style="color:#98C379;">'v3'</span><span style="color:#ABB2BF;">),(</span><span style="color:#D19A66;">4</span><span style="color:#ABB2BF;">, true, </span><span style="color:#98C379;">'v4'</span><span style="color:#ABB2BF;">)</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>After inserting the data, we can simply query the inserted data using the SELECT statement:</p><div class="language-sql line-numbers-mode" data-highlighter="shiki" data-ext="sql" data-title="sql" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> select</span><span style="color:#ABB2BF;"> * </span><span style="color:#C678DD;">from</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">ln</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wf02</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wt02</span><span style="color:#C678DD;"> where</span><span style="color:#C678DD;"> time</span><span style="color:#56B6C2;"> <</span><span style="color:#D19A66;"> 5</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>The result is shown below. The query result shows that the insertion statements of single column and multi column data are performed correctly.</p><div class="language- line-numbers-mode" data-highlighter="shiki" data-ext="" data-title="" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span>+-----------------------------+--------------------------+------------------------+</span></span> |
| <span class="line"><span>| Time|root.ln.wf02.wt02.hardware|root.ln.wf02.wt02.status|</span></span> |
| <span class="line"><span>+-----------------------------+--------------------------+------------------------+</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.001+08:00| v1| true|</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.002+08:00| v2| false|</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.003+08:00| v3| false|</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.004+08:00| v4| true|</span></span> |
| <span class="line"><span>+-----------------------------+--------------------------+------------------------+</span></span> |
| <span class="line"><span>Total line number = 4</span></span> |
| <span class="line"><span>It costs 0.004s</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>In addition, we can omit the timestamp column, and the system will use the current system timestamp as the timestamp of the data point. The sample code is as follows:</p><div class="language-sql line-numbers-mode" data-highlighter="shiki" data-ext="sql" data-title="sql" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> insert into</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">ln</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wf02</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">wt02</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">status</span><span style="color:#ABB2BF;">, hardware) </span><span style="color:#C678DD;">values</span><span style="color:#ABB2BF;"> (false, </span><span style="color:#98C379;">'v2'</span><span style="color:#ABB2BF;">)</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p><strong>Note:</strong> Timestamps must be specified when inserting multiple rows of data in a SQL.</p><h3 id="_1-2-insert-data-into-aligned-timeseries" tabindex="-1"><a class="header-anchor" href="#_1-2-insert-data-into-aligned-timeseries"><span>1.2 Insert Data Into Aligned Timeseries</span></a></h3><p>To insert data into a group of aligned time series, we only need to add the <code>ALIGNED</code> keyword in SQL, and others are similar.</p><p>The sample code is as follows:</p><div class="language-sql line-numbers-mode" data-highlighter="shiki" data-ext="sql" data-title="sql" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> create</span><span style="color:#ABB2BF;"> aligned timeseries </span><span style="color:#D19A66;">root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">sg1</span><span style="color:#ABB2BF;">.d1(s1 INT32, s2 DOUBLE)</span></span> |
| <span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> insert into</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">sg1</span><span style="color:#ABB2BF;">.d1(</span><span style="color:#C678DD;">time</span><span style="color:#ABB2BF;">, s1, s2) aligned </span><span style="color:#C678DD;">values</span><span style="color:#ABB2BF;">(</span><span style="color:#D19A66;">1</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">1</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">1</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> insert into</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">sg1</span><span style="color:#ABB2BF;">.d1(</span><span style="color:#C678DD;">time</span><span style="color:#ABB2BF;">, s1, s2) aligned </span><span style="color:#C678DD;">values</span><span style="color:#ABB2BF;">(</span><span style="color:#D19A66;">2</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">2</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">2</span><span style="color:#ABB2BF;">), (</span><span style="color:#D19A66;">3</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">3</span><span style="color:#ABB2BF;">, </span><span style="color:#D19A66;">3</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#ABB2BF;">IoTDB </span><span style="color:#56B6C2;">></span><span style="color:#C678DD;"> select</span><span style="color:#ABB2BF;"> * </span><span style="color:#C678DD;">from</span><span style="color:#D19A66;"> root</span><span style="color:#ABB2BF;">.</span><span style="color:#D19A66;">sg1</span><span style="color:#ABB2BF;">.d1</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The result is shown below. The query result shows that the insertion statements are performed correctly.</p><div class="language- line-numbers-mode" data-highlighter="shiki" data-ext="" data-title="" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span>+-----------------------------+--------------+--------------+</span></span> |
| <span class="line"><span>| Time|root.sg1.d1.s1|root.sg1.d1.s2|</span></span> |
| <span class="line"><span>+-----------------------------+--------------+--------------+</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.001+08:00| 1| 1.0|</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.002+08:00| 2| 2.0|</span></span> |
| <span class="line"><span>|1970-01-01T08:00:00.003+08:00| 3| 3.0|</span></span> |
| <span class="line"><span>+-----------------------------+--------------+--------------+</span></span> |
| <span class="line"><span>Total line number = 3</span></span> |
| <span class="line"><span>It costs 0.004s</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="_2-native-api-write" tabindex="-1"><a class="header-anchor" href="#_2-native-api-write"><span>2. NATIVE API WRITE</span></a></h2><p>The Native API ( Session ) is the most widely used series of APIs of IoTDB, including multiple APIs, adapted to different data collection scenarios, with high performance and multi-language support.</p><h3 id="_2-1-multi-language-api-write" tabindex="-1"><a class="header-anchor" href="#_2-1-multi-language-api-write"><span>2.1 Multi-language API write</span></a></h3><h4 id="java" tabindex="-1"><a class="header-anchor" href="#java"><span>Java</span></a></h4>`,26)),e("p",null,[s[21]||(s[21]=a("Before writing via the Java API, you need to establish a connection, refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-Java-Native-API.html"},{default:l(()=>s[19]||(s[19]=[a("Java Native API")])),_:1}),s[22]||(s[22]=a(".")),s[23]||(s[23]=e("br",null,null,-1)),s[24]||(s[24]=a(" then refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-Java-Native-API.html#insert"},{default:l(()=>s[20]||(s[20]=[a(" JAVA Data Manipulation Interface (DML) ")])),_:1})]),s[48]||(s[48]=e("h4",{id:"python",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#python"},[e("span",null,"Python")])],-1)),e("p",null,[s[26]||(s[26]=a("Refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-Python-Native-API.html#insert"},{default:l(()=>s[25]||(s[25]=[a(" Python Data Manipulation Interface (DML) ")])),_:1})]),s[49]||(s[49]=e("h4",{id:"c",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#c"},[e("span",null,"C++")])],-1)),e("p",null,[s[28]||(s[28]=a("Refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-Cpp-Native-API.html#insert"},{default:l(()=>s[27]||(s[27]=[a(" C++ Data Manipulation Interface (DML) ")])),_:1})]),s[50]||(s[50]=e("h4",{id:"go",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#go"},[e("span",null,"Go")])],-1)),e("p",null,[s[30]||(s[30]=a("Refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-Go-Native-API.html"},{default:l(()=>s[29]||(s[29]=[a("Go Native API")])),_:1})]),s[51]||(s[51]=e("h2",{id:"_3-rest-api-write",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_3-rest-api-write"},[e("span",null,"3. REST API WRITE")])],-1)),e("p",null,[s[33]||(s[33]=a("Refer to ")),t(n,{to:"/UserGuide/latest/API/RestServiceV1.html#inserttablet"},{default:l(()=>s[31]||(s[31]=[a("insertTablet (v1)")])),_:1}),s[34]||(s[34]=a(" or ")),t(n,{to:"/UserGuide/latest/API/RestServiceV2.html#inserttablet"},{default:l(()=>s[32]||(s[32]=[a("insertTablet (v2)")])),_:1})]),s[52]||(s[52]=o(`<p>Example:</p><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" data-title="json" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">{</span></span> |
| <span class="line"><span style="color:#E06C75;"> "timestamps"</span><span style="color:#ABB2BF;">: [</span></span> |
| <span class="line"><span style="color:#D19A66;"> 1</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#D19A66;"> 2</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#D19A66;"> 3</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ],</span></span> |
| <span class="line"><span style="color:#E06C75;"> "measurements"</span><span style="color:#ABB2BF;">: [</span></span> |
| <span class="line"><span style="color:#98C379;"> "temperature"</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#98C379;"> "status"</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ],</span></span> |
| <span class="line"><span style="color:#E06C75;"> "data_types"</span><span style="color:#ABB2BF;">: [</span></span> |
| <span class="line"><span style="color:#98C379;"> "FLOAT"</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#98C379;"> "BOOLEAN"</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ],</span></span> |
| <span class="line"><span style="color:#E06C75;"> "values"</span><span style="color:#ABB2BF;">: [</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> [</span></span> |
| <span class="line"><span style="color:#D19A66;"> 1.1</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#D19A66;"> 2.2</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#D19A66;"> 3.3</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ],</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> [</span></span> |
| <span class="line"><span style="color:#56B6C2;"> false</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#56B6C2;"> true</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#56B6C2;"> true</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ]</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> ],</span></span> |
| <span class="line"><span style="color:#E06C75;"> "is_aligned"</span><span style="color:#ABB2BF;">: </span><span style="color:#D19A66;">false</span><span style="color:#ABB2BF;">,</span></span> |
| <span class="line"><span style="color:#E06C75;"> "device"</span><span style="color:#ABB2BF;">: </span><span style="color:#98C379;">"root.ln.wf01.wt01"</span></span> |
| <span class="line"><span style="color:#ABB2BF;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="_4-mqtt-write" tabindex="-1"><a class="header-anchor" href="#_4-mqtt-write"><span>4. MQTT WRITE</span></a></h2>`,3)),e("p",null,[s[36]||(s[36]=a("Refer to ")),t(n,{to:"/UserGuide/latest/API/Programming-MQTT.html#built-in-mqtt-service"},{default:l(()=>s[35]||(s[35]=[a("Built-in MQTT Service")])),_:1})]),s[53]||(s[53]=e("h2",{id:"_5-batch-data-load",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_5-batch-data-load"},[e("span",null,"5. BATCH DATA LOAD")])],-1)),s[54]||(s[54]=e("p",null,"In different scenarios, the IoTDB provides a variety of methods for importing data in batches. This section describes the two most common methods for importing data in CSV format and TsFile format.",-1)),s[55]||(s[55]=e("h3",{id:"_5-1-tsfile-batch-load",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_5-1-tsfile-batch-load"},[e("span",null,"5.1 TsFile Batch Load")])],-1)),e("p",null,[s[38]||(s[38]=a("TsFile is the file format of time series used in IoTDB. You can directly import one or more TsFile files with time series into another running IoTDB instance through tools such as CLI. For details, see ")),t(n,{to:"/UserGuide/latest/Tools-System/Data-Import-Tool.html"},{default:l(()=>s[37]||(s[37]=[a("Data Import")])),_:1}),s[39]||(s[39]=a("."))]),s[56]||(s[56]=e("h3",{id:"_5-2-csv-batch-load",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_5-2-csv-batch-load"},[e("span",null,"5.2 CSV Batch Load")])],-1)),e("p",null,[s[41]||(s[41]=a("CSV stores table data in plain text. You can write multiple formatted data into a CSV file and import the data into the IoTDB in batches. Before importing data, you are advised to create the corresponding metadata in the IoTDB. Don't worry if you forget to create one, the IoTDB can automatically infer the data in the CSV to its corresponding data type, as long as you have a unique data type for each column. In addition to a single file, the tool supports importing multiple CSV files as folders and setting optimization parameters such as time precision. For details, see ")),t(n,{to:"/UserGuide/latest/Tools-System/Data-Import-Tool.html"},{default:l(()=>s[40]||(s[40]=[a("Data Import")])),_:1}),s[42]||(s[42]=a("."))]),s[57]||(s[57]=e("h2",{id:"_6-schemaless-writing",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_6-schemaless-writing"},[e("span",null,"6. SCHEMALESS WRITING")])],-1)),s[58]||(s[58]=e("p",null,"In IoT scenarios, the types and quantities of devices may dynamically increase or decrease over time, and different devices may generate data with varying fields (e.g., temperature, humidity, status codes). Additionally, businesses often require rapid deployment and flexible integration of new devices without cumbersome predefined processes. Therefore, unlike traditional time-series databases that typically require predefining data models, IoTDB supports schema-less writing, where the database automatically identifies and registers the necessary metadata during data writing, enabling automatic modeling.",-1)),s[59]||(s[59]=e("p",null,[a("Users can either use CLI "),e("code",null,"INSERT"),a(" statements or native APIs to write data in real-time, either in batches or row-by-row, for single or multiple devices. Alternatively, they can import historical data in formats such as CSV or TsFile using import tools, during which metadata like time series, data types, and compression encoding methods are automatically created.")],-1))])}const y=i(c,[["render",u],["__file","Write-Data.html.vue"]]),v=JSON.parse('{"path":"/UserGuide/latest/Basic-Concept/Write-Data.html","title":"Write Data","lang":"en-US","frontmatter":{"description":"Write Data 1. CLI INSERT IoTDB provides users with a variety of ways to insert real-time data, such as directly inputting in , or using to perform single or batch execution of ....","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://iotdb.apache.org/zh/UserGuide/latest/Basic-Concept/Write-Data.html"}],["meta",{"property":"og:url","content":"https://iotdb.apache.org/UserGuide/latest/Basic-Concept/Write-Data.html"}],["meta",{"property":"og:site_name","content":"IoTDB Website"}],["meta",{"property":"og:title","content":"Write Data"}],["meta",{"property":"og:description","content":"Write Data 1. CLI INSERT IoTDB provides users with a variety of ways to insert real-time data, such as directly inputting in , or using to perform single or batch execution of ...."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2025-03-06T10:20:12.000Z"}],["meta",{"property":"article:modified_time","content":"2025-03-06T10:20:12.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"Write Data\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2025-03-06T10:20:12.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":2,"title":"1. CLI INSERT","slug":"_1-cli-insert","link":"#_1-cli-insert","children":[{"level":3,"title":"1.1 Use of INSERT Statements","slug":"_1-1-use-of-insert-statements","link":"#_1-1-use-of-insert-statements","children":[]},{"level":3,"title":"1.2 Insert Data Into Aligned Timeseries","slug":"_1-2-insert-data-into-aligned-timeseries","link":"#_1-2-insert-data-into-aligned-timeseries","children":[]}]},{"level":2,"title":"2. NATIVE API WRITE","slug":"_2-native-api-write","link":"#_2-native-api-write","children":[{"level":3,"title":"2.1 Multi-language API write","slug":"_2-1-multi-language-api-write","link":"#_2-1-multi-language-api-write","children":[]}]},{"level":2,"title":"3. REST API WRITE","slug":"_3-rest-api-write","link":"#_3-rest-api-write","children":[]},{"level":2,"title":"4. MQTT WRITE","slug":"_4-mqtt-write","link":"#_4-mqtt-write","children":[]},{"level":2,"title":"5. BATCH DATA LOAD","slug":"_5-batch-data-load","link":"#_5-batch-data-load","children":[{"level":3,"title":"5.1 TsFile Batch Load","slug":"_5-1-tsfile-batch-load","link":"#_5-1-tsfile-batch-load","children":[]},{"level":3,"title":"5.2 CSV Batch Load","slug":"_5-2-csv-batch-load","link":"#_5-2-csv-batch-load","children":[]}]},{"level":2,"title":"6. SCHEMALESS WRITING","slug":"_6-schemaless-writing","link":"#_6-schemaless-writing","children":[]}],"git":{"createdTime":1690869728000,"updatedTime":1741256412000,"contributors":[{"name":"Lei","username":"Lei","email":"33376433+LeiRui@users.noreply.github.com","commits":1,"url":"https://github.com/Lei"},{"name":"wanghui42","username":"wanghui42","email":"105700158+wanghui42@users.noreply.github.com","commits":1,"url":"https://github.com/wanghui42"},{"name":"Summer","username":"Summer","email":"43237967+2b3c511@users.noreply.github.com","commits":1,"url":"https://github.com/Summer"},{"name":"2b3c511","username":"2b3c511","email":"rong.li@timecho.com","commits":1,"url":"https://github.com/2b3c511"},{"name":"W1y1r","username":"W1y1r","email":"150988475+W1y1r@users.noreply.github.com","commits":4,"url":"https://github.com/W1y1r"},{"name":"leto-b","username":"leto-b","email":"bingqian.bai@timecho.com","commits":3,"url":"https://github.com/leto-b"}]},"readingTime":{"minutes":4.22,"words":1266},"filePathRelative":"UserGuide/latest/Basic-Concept/Write-Data.md","localizedDate":"August 1, 2023","autoDesc":true}');export{y as comp,v as data}; |