diff --git a/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md b/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md index 3c71156b3..1f5f83c01 100644 --- a/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md +++ b/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md @@ -90,6 +90,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + + ### 2.3 SQL Format #### 2.3.1 Command diff --git a/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md b/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md index 645fa6bd7..b080e0fd3 100644 --- a/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md +++ b/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md @@ -90,6 +90,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + + ### 2.3 SQL Format #### 2.3.1 Command diff --git a/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md b/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md index 75229ae09..1ab92edd2 100644 --- a/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md +++ b/src/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md @@ -104,6 +104,49 @@ IoTDB currently supports importing data in CSV, SQL, and TsFile (IoTDB's underly >tools/import-data.bat -h 192.168.100.1 -p 6667 -u root -pw root -s ./data/dump0_0.csv -fd ./failed/ -aligned true -batch 100000 -tp ms -typeInfer boolean=text,float=double -lpf 1000 ``` +### 2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + ## 3. load-tsfile Script diff --git a/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md b/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md index 645fa6bd7..b080e0fd3 100644 --- a/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md +++ b/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md @@ -90,6 +90,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + + ### 2.3 SQL Format #### 2.3.1 Command diff --git a/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md b/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md index 75229ae09..1ab92edd2 100644 --- a/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md +++ b/src/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md @@ -104,6 +104,49 @@ IoTDB currently supports importing data in CSV, SQL, and TsFile (IoTDB's underly >tools/import-data.bat -h 192.168.100.1 -p 6667 -u root -pw root -s ./data/dump0_0.csv -fd ./failed/ -aligned true -batch 100000 -tp ms -typeInfer boolean=text,float=double -lpf 1000 ``` +### 2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + ## 3. load-tsfile Script diff --git a/src/UserGuide/latest/Tools-System/Data-Import-Tool.md b/src/UserGuide/latest/Tools-System/Data-Import-Tool.md index 3c71156b3..1f5f83c01 100644 --- a/src/UserGuide/latest/Tools-System/Data-Import-Tool.md +++ b/src/UserGuide/latest/Tools-System/Data-Import-Tool.md @@ -90,6 +90,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 Import Notes + +1. CSV Import Specifications + +- Special Character Escaping Rules: If a text-type field contains special characters (e.g., commas ,), they must be escaped using a backslash (\). +- Supported Time Formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd HH:mm:ss, or yyyy-MM-dd'T'HH:mm:ss.SSSZ. +- Timestamp Column Requirement: The timestamp column must be the first column in the data file. + +2. CSV File Example + +- Time Alignment + +```sql +-- Headers without data types +Time,root.test.t1.str,root.test.t2.str,root.test.t2.var +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,"123",, + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- Device Alignment + +```sql +-- Headers without data types +Time,Device,str,var +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- Headers with data types (Text-type data supports both quoted and unquoted formats) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + + ### 2.3 SQL Format #### 2.3.1 Command diff --git a/src/zh/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md b/src/zh/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md index 2bb4516cf..fd267bcb7 100644 --- a/src/zh/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md +++ b/src/zh/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md @@ -52,7 +52,7 @@ IoTDB 支持两种方式进行数据导入 | -help | --help | 显示帮助信息,支持分开展示和全部展示`-help`或`-help csv` | 否 | | -### 2.2 Csv 格式 +### 2.2 CSV 格式 #### 2.2.1 运行命令 @@ -98,7 +98,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` -### 2.3 Sql 格式 +#### 2.3.4 导入说明 + +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + +### 2.3 SQL 格式 #### 2.2.1 运行命令 diff --git a/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md b/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md index 2bb4516cf..cf16611e9 100644 --- a/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md +++ b/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool-1-3-4.md @@ -52,7 +52,7 @@ IoTDB 支持两种方式进行数据导入 | -help | --help | 显示帮助信息,支持分开展示和全部展示`-help`或`-help csv` | 否 | | -### 2.2 Csv 格式 +### 2.2 CSV 格式 #### 2.2.1 运行命令 @@ -97,8 +97,50 @@ error: Source file or directory /non_path does not exist > tools/import-data.sh -ft csv -s /path/sql -tn 0 error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 导入说明 -### 2.3 Sql 格式 +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + +### 2.3 SQL 格式 #### 2.2.1 运行命令 diff --git a/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md b/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md index 4c14acdf9..c7466d909 100644 --- a/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md +++ b/src/zh/UserGuide/V1.3.x/Tools-System/Data-Import-Tool.md @@ -100,6 +100,49 @@ IoTDB 目前支持将 CSV、SQL、及TsFile(IoTDB底层开放式时间序列 >tools/import-data.bat -h 192.168.100.1 -p 6667 -u root -pw root -s ./data/dump0_0.csv -fd ./failed/ -aligned true -batch 100000 -tp ms -typeInfer boolean=text,float=double -lpf 1000 ``` +### 2.4 导入说明 + +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + ## 3. load-tsfile 脚本 - 支持格式:TsFile diff --git a/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md b/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md index 2bb4516cf..cf16611e9 100644 --- a/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md +++ b/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool-1-3-4.md @@ -52,7 +52,7 @@ IoTDB 支持两种方式进行数据导入 | -help | --help | 显示帮助信息,支持分开展示和全部展示`-help`或`-help csv` | 否 | | -### 2.2 Csv 格式 +### 2.2 CSV 格式 #### 2.2.1 运行命令 @@ -97,8 +97,50 @@ error: Source file or directory /non_path does not exist > tools/import-data.sh -ft csv -s /path/sql -tn 0 error: Invalid thread number '0'. Please set a positive integer. ``` +#### 2.2.4 导入说明 -### 2.3 Sql 格式 +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + +### 2.3 SQL 格式 #### 2.2.1 运行命令 diff --git a/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md b/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md index 4c14acdf9..c7466d909 100644 --- a/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md +++ b/src/zh/UserGuide/dev-1.3/Tools-System/Data-Import-Tool.md @@ -100,6 +100,49 @@ IoTDB 目前支持将 CSV、SQL、及TsFile(IoTDB底层开放式时间序列 >tools/import-data.bat -h 192.168.100.1 -p 6667 -u root -pw root -s ./data/dump0_0.csv -fd ./failed/ -aligned true -batch 100000 -tp ms -typeInfer boolean=text,float=double -lpf 1000 ``` +### 2.4 导入说明 + +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + ## 3. load-tsfile 脚本 - 支持格式:TsFile diff --git a/src/zh/UserGuide/latest/Tools-System/Data-Import-Tool.md b/src/zh/UserGuide/latest/Tools-System/Data-Import-Tool.md index 2bb4516cf..fd267bcb7 100644 --- a/src/zh/UserGuide/latest/Tools-System/Data-Import-Tool.md +++ b/src/zh/UserGuide/latest/Tools-System/Data-Import-Tool.md @@ -52,7 +52,7 @@ IoTDB 支持两种方式进行数据导入 | -help | --help | 显示帮助信息,支持分开展示和全部展示`-help`或`-help csv` | 否 | | -### 2.2 Csv 格式 +### 2.2 CSV 格式 #### 2.2.1 运行命令 @@ -98,7 +98,50 @@ error: Source file or directory /non_path does not exist error: Invalid thread number '0'. Please set a positive integer. ``` -### 2.3 Sql 格式 +#### 2.3.4 导入说明 + +1. CSV 导入规范 + +- 特殊字符转义规则:若Text类型的字段中包含特殊字符(例如逗号,),需使用反斜杠(\)​进行转义处理。 +- 支持的时间格式:yyyy-MM-dd'T'HH:mm:ss, yyy-MM-dd HH:mm:ss, 或者 yyyy-MM-dd'T'HH:mm:ss.SSSZ。 +- 时间戳列​必须作为数据文件的首列存在。 + +2. CSV 文件示例 + +- 时间对齐 + +```sql +-- header 中不包含数据类型 + Time,root.test.t1.str,root.test.t2.str,root.test.t2.var + 1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 + 1970-01-01T08:00:00.002+08:00,"123",, + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,root.test.t1.str(TEXT),root.test.t2.str(TEXT),root.test.t2.var(INT32) +1970-01-01T08:00:00.001+08:00,"123hello world","123\,abc",100 +1970-01-01T08:00:00.002+08:00,123,hello world,123 +1970-01-01T08:00:00.003+08:00,"123",, +1970-01-01T08:00:00.004+08:00,123,,12 +``` + +- 设备对齐 + +```sql +-- header 中不包含数据类型 + Time,Device,str,var + 1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", + 1970-01-01T08:00:00.002+08:00,root.test.t1,"123", + 1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 + +-- header 中包含数据类型(Text 类型数据支持加双引号和不加双引号) +Time,Device,str(TEXT),var(INT32) +1970-01-01T08:00:00.001+08:00,root.test.t1,"123hello world", +1970-01-01T08:00:00.002+08:00,root.test.t1,"123", +1970-01-01T08:00:00.001+08:00,root.test.t2,"123\,abc",100 +1970-01-01T08:00:00.002+08:00,root.test.t1,hello world,123 +``` + +### 2.3 SQL 格式 #### 2.2.1 运行命令