diff --git a/src/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md b/src/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
index b56e4a4a0..f8084f79c 100644
--- a/src/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
+++ b/src/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
@@ -1,7 +1,11 @@
# Data Import
## 1. Functional Overview
-The data import tool `import-data.sh/bat` is located in the `tools` directory and can import data in CSV, SQL, and TsFile (an open-source time-series file format) into IoTDB. Its specific functionalities are as follows:
+
+IoTDB supports three methods for data import:
+- Data Import Tool: Use the `import-data.sh/bat` script in the `tools` directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
+- `TsFile` Auto-Loading Feature
+- Load `TsFile` SQL
@@ -19,13 +23,21 @@ The data import tool `import-data.sh/bat` is located in the `tools` directory an
Can be used for single or batch import of SQL files into IoTDB
-
TsFile
+
TsFile
Can be used for single or batch import of TsFile files into IoTDB
-
+
+
+
TsFile Auto-Loading Feature
+
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB
+
+
+
Load SQL
+
Can be used for single or batch import of TsFile files into IoTDB
+
-## 2. Detailed Features
+## 2. Data Import Tool
### 2.1 Common Parameters
| Short | Full Parameter | Description | Required | Default |
@@ -45,9 +57,9 @@ The data import tool `import-data.sh/bat` is located in the `tools` directory an
| `-tz` | `--timezone` | Timezone (e.g., `+08:00`, `-01:00`). | No | System default |
| `-help` | `--help` | Display help (general or format-specific: `-help csv`). | No | - |
-### 2.2 CSV Format
+### 2.2 CSV Format
-#### 2.2.1 Command
+#### 2.2.1 Command
```Shell
# Unix/OS X
> tools/import-data.sh -ft [-sql_dialect] -db -table
@@ -64,7 +76,7 @@ The data import tool `import-data.sh/bat` is located in the `tools` directory an
[-tn ]
```
-#### 2.2.2 CSV-Specific Parameters
+#### 2.2.2 CSV-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| ---------------- | ------------------------------- |----------------------------------------------------------| ---------- |-----------------|
@@ -75,7 +87,7 @@ The data import tool `import-data.sh/bat` is located in the `tools` directory an
| `-ti` | `--type_infer` | Type mapping (e.g., `BOOLEAN=text,INT=long`). | No | - |
| `-tp` | `--timestamp_precision` | Timestamp precision: `ms`, `us`, `ns`. | No | `ms` |
-#### 2.2.3 Examples
+#### 2.2.3 Examples
```Shell
# Valid Example
@@ -95,7 +107,7 @@ There are no tables or the target table table5 does not exist
- 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.
+- Timestamp Column Requirement: The timestamp column must be the first column in the data file.
2. CSV File Example
@@ -106,9 +118,9 @@ time,region,device,model,temperature,humidity
```
-### 2.3 SQL Format
+### 2.3 SQL Format
-#### 2.3.1 Command
+#### 2.3.1 Command
```Shell
# Unix/OS X
@@ -124,7 +136,7 @@ time,region,device,model,temperature,humidity
[-batch ] [-tn ]
```
-#### 2.3.2 SQL-Specific Parameters
+#### 2.3.2 SQL-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| -------------- | ------------------------------- | -------------------------------------------------------------------- | ---------- | ------------------ |
@@ -132,7 +144,7 @@ time,region,device,model,temperature,humidity
| `-lpf` | `--lines_per_failed_file` | Max lines per failed file. | No | `100000` Range: 0 to Integer.Max(2147483647). |
| `-batch` | `--batch_size` | Rows processed per API call. | No | `100000` Range: 0 to Integer.Max(2147483647). |
-#### 2.3.3 Examples
+#### 2.3.3 Examples
```Shell
# Valid Example
@@ -146,9 +158,9 @@ Source file or directory ./sql/dump1_1.sql does not exist
# Log Example
Fail to insert measurements '[column.name]' caused by [data type is not consistent, input '[column.value]', registered '[column.DataType]']
```
-### 2.4 TsFile Format
+### 2.4 TsFile Format
-#### 2.4.1 Command
+#### 2.4.1 Command
```Shell
# Unix/OS X
@@ -163,7 +175,7 @@ Fail to insert measurements '[column.name]' caused by [data type is not consiste
-s -os [-sd ] -of [-fd ]
[-tn ] [-tz ] [-tp ]
```
-#### 2.4.2 TsFile-Specific Parameters
+#### 2.4.2 TsFile-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| ----------- | ----------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ----------------- | --------------------------- |
@@ -173,7 +185,7 @@ Fail to insert measurements '[column.name]' caused by [data type is not consiste
| `-fd` | `--fail_dir` | Target directory for `mv`/`cp` actions on failure. Required if `-of` is `mv`/`cp`. The file name will be flattened and concatenated with the original file name. | Conditional | `${EXEC_DIR}/fail` |
| `-tp` | `--timestamp_precision` | TsFile timestamp precision: `ms`, `us`, `ns`. For non-remote TsFile imports: Use -tp to specify the timestamp precision of the TsFile. The system will manually verify if the timestamp precision matches the server. If it does not match, an error will be returned. For remote TsFile imports: Use -tp to specify the timestamp precision of the TsFile. The Pipe system will automatically verify if the timestamp precision matches. If it does not match, a Pipe error will be returned. | No | `ms` |
-#### 2.4.3 Examples
+#### 2.4.3 Examples
```Shell
# Valid Example
@@ -183,3 +195,105 @@ Fail to insert measurements '[column.name]' caused by [data type is not consiste
> tools/import-data.sh -ft tsfile -sql_dialect table -s ./tsfile -db database1
Parse error: Missing required options: os, of
```
+
+## 3. TsFile Auto-Loading
+
+This feature enables IoTDB to automatically monitor a specified directory for new TsFiles and load them into the database without manual intervention.
+
+
+
+### 3.1 Configuration
+
+Add the following parameters to `iotdb-system.properties` (template: `iotdb-system.properties.template`):
+
+| Parameter | Description | Value Range | Required | Default | Hot-Load? |
+| ---------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------| ---------- | ----------------------------- | ----------------------- |
+| `load_active_listening_enable` | Enable auto-loading. | `true`/`false` | Optional | `true` | Yes |
+| `load_active_listening_dirs` | Directories to monitor (subdirectories included). Multiple paths separated by commas. Note: In the table model, the directory name where the file is located will be used as the database. | String | Optional | `ext/load/pending` | Yes |
+| `load_active_listening_fail_dir` | Directory to store failed TsFiles. Only can set one. | String | Optional | `ext/load/failed` | Yes |
+| `load_active_listening_max_thread_num` | Maximum Threads for TsFile Loading Tasks:The default value for this parameter, when commented out, is max(1, CPU cores / 2). If the value set by the user falls outside the range [1, CPU cores / 2], it will be reset to the default value of max(1, CPU cores / 2). | `1` to `Long.MAX_VALUE` | Optional | `max(1, CPU_CORES / 2)` | No (restart required) |
+| `load_active_listening_check_interval_seconds` | Active Listening Polling Interval (in seconds):The active listening feature for TsFiles is implemented through polling the target directory. This configuration specifies the time interval between two consecutive checks of the `load_active_listening_dirs`. After each check, the next check will be performed after `load_active_listening_check_interval_seconds` seconds. If the polling interval set by the user is less than 1, it will be reset to the default value of 5 seconds. | `1` to `Long.MAX_VALUE` | Optional | `5` | No (restart required) |
+
+### 3.2 Examples
+
+```bash
+load_active_listening_dir/
+├─sensors/
+│ ├─temperature/
+│ │ └─temperature-table.TSFILE
+
+```
+
+- Table model TsFile
+ - `temperature-table.TSFILE`: will be imported into the `temperature` database (because it is located in the `sensors/temperature/` directory)
+
+
+### 3.3 Notes
+
+1. **Mods Files**: If TsFiles have associated `.mods` files, move `.mods` files to the monitored directory **before** their corresponding TsFiles. Ensure `.mods` and TsFiles are in the same directory.
+2. **Restricted Directories**: Do NOT set Pipe receiver directories, data directories, or other system paths as monitored directories.
+3. **Directory Conflicts**: Ensure `load_active_listening_fail_dir` does not overlap with `load_active_listening_dirs` or its subdirectories.
+4. **Permissions**: The monitored directory must have write permissions. Files are deleted after successful loading; insufficient permissions may cause duplicate loading.
+
+
+## 4. Load SQL
+
+IoTDB supports importing one or multiple TsFile files containing time series into another running IoTDB instance directly via SQL execution through the CLI.
+
+### 4.1 Command
+
+```SQL
+load '' with (
+ 'attribute-key1'='attribute-value1',
+ 'attribute-key2'='attribute-value2',
+)
+```
+
+* `` : The path to a TsFile or a folder containing multiple TsFiles.
+* ``: Optional parameters, as described below.
+
+| Key | Key Description | Value Type | Value Range | Value is Required | Default Value |
+|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------|-------------------|----------------------------|
+| `database-level` | When the database corresponding to the TsFile does not exist, the database hierarchy level can be specified via the ` database-level` parameter. The default is the level set in `iotdb-common.properties`. For example, setting level=1 means the prefix path of level 1 in all time series in the TsFile will be used as the database. | Integer | `[1: Integer.MAX_VALUE]` | No | 1 |
+| `on-success` | Action for successfully loaded TsFiles: `delete` (delete the TsFile after successful import) or `none` (retain the TsFile in the source folder). | String | `delete / none` | No | delete |
+| `model` | Specifies whether the TsFile uses the `table` model or `tree` model. | String | `tree / table` | No | Aligns with `-sql_dialect` |
+| `database-name` | Table model only: Target database for import. Automatically created if it does not exist. The database-name must not include the `root.` prefix (an error will occur if included). | String | `-` | No | null |
+| `convert-on-type-mismatch` | Whether to perform type conversion during loading if data types in the TsFile mismatch the target schema. | Boolean | `true / false` | No | true |
+| `verify` | Whether to validate the schema before loading the TsFile. | Boolean | `true / false` | No | true |
+| `tablet-conversion-threshold` | Size threshold (in bytes) for converting TsFiles into tablet format during loading. Default: `-1` (no conversion for any TsFile). | Integer | `[-1,0 :``Integer.MAX_VALUE]` | No | -1 |
+| `async` | Whether to enable asynchronous loading. If enabled, TsFiles are moved to an active-load directory and loaded into the `database-name` asynchronously. | Boolean | `true / false` | No | false |
+
+### 4.2 Example
+
+```SQL
+-- Create target database: database2
+IoTDB> create database database2
+Msg: The statement is executed successfully.
+
+IoTDB> use database2
+Msg: The statement is executed successfully.
+
+IoTDB:database2> show tables details
++---------+-------+------+-------+
+|TableName|TTL(ms)|Status|Comment|
++---------+-------+------+-------+
++---------+-------+------+-------+
+Empty set.
+
+-- Import tsfile by excuting load sql
+IoTDB:database2> load '/home/dump0.tsfile' with ( 'on-success'='none', 'database-name'='database2')
+Msg: The statement is executed successfully.
+
+-- Verify whether the import was successful
+IoTDB:database2> select * from table2
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+| time|region|plant_id|device_id|temperature|humidity|status| arrival_time|
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+|2024-11-30T00:00:00.000+08:00| 上海| 3002| 101| 90.0| 35.2| true| null|
+|2024-11-29T00:00:00.000+08:00| 上海| 3001| 101| 85.0| 35.1| null|2024-11-29T10:00:13.000+08:00|
+|2024-11-27T00:00:00.000+08:00| 北京| 1001| 101| 85.0| 35.1| true|2024-11-27T16:37:01.000+08:00|
+|2024-11-29T11:00:00.000+08:00| 上海| 3002| 100| null| 45.1| true| null|
+|2024-11-28T08:00:00.000+08:00| 上海| 3001| 100| 85.0| 35.2| false|2024-11-28T08:00:09.000+08:00|
+|2024-11-26T13:37:00.000+08:00| 北京| 1001| 100| 90.0| 35.1| true|2024-11-26T13:37:34.000+08:00|
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+```
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 1f5f83c01..efa6ba679 100644
--- a/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md
+++ b/src/UserGuide/Master/Tree/Tools-System/Data-Import-Tool.md
@@ -1,9 +1,10 @@
# Data Import
## 1. Overview
-IoTDB supports two methods for data import:
-* Data Import Tool: Use the import-data.sh (Unix/OS X) or import-data.bat (Windows) script in the tools directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
-* TsFile Auto-Loading Feature
+IoTDB supports three methods for data import:
+- Data Import Tool: Use the `import-data.sh/bat` script in the `tools` directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
+- `TsFile` Auto-Loading Feature
+- Load `TsFile` SQL
@@ -21,12 +22,16 @@ IoTDB supports two methods for data import:
Can be used for single or batch import of SQL files into IoTDB
-
TsFile
+
TsFile
Can be used for single or batch import of TsFile files into IoTDB
-
TsFile Auto-Loading Feature
-
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB.
+
TsFile Auto-Loading Feature
+
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB
+
+
+
Load SQL
+
Can be used for single or batch import of TsFile files into IoTDB
@@ -46,9 +51,9 @@ IoTDB supports two methods for data import:
| `-tz` | `--timezone` | Timezone (e.g., `+08:00`, `-01:00`). | No | System default |
| `-help` | `--help` | Display help (general or format-specific: `-help csv`). | No | - |
-### 2.2 CSV Format
+### 2.2 CSV Format
-#### 2.2.1 Command
+#### 2.2.1 Command
```Shell
# Unix/OS X
> tools/import-data.sh -ft [-h ] [-p ] [-u ] [-pw ]
@@ -63,7 +68,7 @@ IoTDB supports two methods for data import:
[-tn ]
```
-#### 2.2.2 CSV-Specific Parameters
+#### 2.2.2 CSV-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| ---------------- | ------------------------------- |----------------------------------------------------------| ---------- |-----------------|
@@ -74,7 +79,7 @@ IoTDB supports two methods for data import:
| `-ti` | `--type_infer` | Type mapping (e.g., `BOOLEAN=text,INT=long`). | No | - |
| `-tp` | `--timestamp_precision` | Timestamp precision: `ms`, `us`, `ns`. | No | `ms` |
-#### 2.2.3 Examples
+#### 2.2.3 Examples
```Shell
# Valid Example
@@ -134,9 +139,9 @@ Time,Device,str(TEXT),var(INT32)
```
-### 2.3 SQL Format
+### 2.3 SQL Format
-#### 2.3.1 Command
+#### 2.3.1 Command
```Shell
# Unix/OS X
@@ -150,7 +155,7 @@ Time,Device,str(TEXT),var(INT32)
[-batch ] [-tn ]
```
-#### 2.3.2 SQL-Specific Parameters
+#### 2.3.2 SQL-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| -------------- | ------------------------------- | -------------------------------------------------------------------- | ---------- | ------------------ |
@@ -158,7 +163,7 @@ Time,Device,str(TEXT),var(INT32)
| `-lpf` | `--lines_per_failed_file` | Max lines per failed file. | No | `100000` Range: 0 to Integer.Max(2147483647). |
| `-batch` | `--batch_size` | Rows processed per API call. | No | `100000` Range: 0 to Integer.Max(2147483647). |
-#### 2.3.3 Examples
+#### 2.3.3 Examples
```Shell
# Valid Example
@@ -174,9 +179,9 @@ error: Source file or directory /path/sql does not exist
> tools/import-data.sh -ft sql -s /path/sql -tn 0
error: Invalid thread number '0'. Please set a positive integer.
```
-### 2.4 TsFile Format
+### 2.4 TsFile Format
-#### 2.4.1 Command
+#### 2.4.1 Command
```Shell
# Unix/OS X
@@ -189,7 +194,7 @@ error: Invalid thread number '0'. Please set a positive integer.
-s -os [-sd ] -of [-fd ]
[-tn ] [-tz ] [-tp ]
```
-#### 2.4.2 TsFile-Specific Parameters
+#### 2.4.2 TsFile-Specific Parameters
| Short | Full Parameter | Description | Required | Default |
| ----------- | ----------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ----------------- | --------------------------- |
@@ -199,7 +204,7 @@ error: Invalid thread number '0'. Please set a positive integer.
| `-fd` | `--fail_dir` | Target directory for `mv`/`cp` actions on failure. Required if `-of` is `mv`/`cp`. The file name will be flattened and concatenated with the original file name. | Conditional | `${EXEC_DIR}/fail` |
| `-tp` | `--timestamp_precision` | TsFile timestamp precision: `ms`, `us`, `ns`. For non-remote TsFile imports: Use -tp to specify the timestamp precision of the TsFile. The system will manually verify if the timestamp precision matches the server. If it does not match, an error will be returned. For remote TsFile imports: Use -tp to specify the timestamp precision of the TsFile. The Pipe system will automatically verify if the timestamp precision matches. If it does not match, a Pipe error will be returned. | No | `ms` |
-#### 2.4.3 Examples
+#### 2.4.3 Examples
```Shell
# Valid Example
@@ -242,3 +247,54 @@ Add the following parameters to `iotdb-system.properties` (template: `iotdb-syst
2. **Restricted Directories**: Do NOT set Pipe receiver directories, data directories, or other system paths as monitored directories.
3. **Directory Conflicts**: Ensure `load_active_listening_fail_dir` does not overlap with `load_active_listening_dirs` or its subdirectories.
4. **Permissions**: The monitored directory must have write permissions. Files are deleted after successful loading; insufficient permissions may cause duplicate loading.
+
+## 4. Load SQL
+
+IoTDB supports importing one or multiple TsFile files containing time series into another running IoTDB instance directly via SQL execution through the CLI.
+
+### 4.1 Command
+
+```SQL
+load '' with (
+ 'attribute-key1'='attribute-value1',
+ 'attribute-key2'='attribute-value2',
+)
+```
+
+* `` : The path to a TsFile or a folder containing multiple TsFiles.
+* ``: Optional parameters, as described below.
+
+| Key | Key Description | Value Type | Value Range | Value is Required | Default Value |
+|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------|-------------------|----------------------------|
+| `database-level` | When the database corresponding to the TsFile does not exist, the database hierarchy level can be specified via the ` database-level` parameter. The default is the level set in `iotdb-common.properties`. For example, setting level=1 means the prefix path of level 1 in all time series in the TsFile will be used as the database. | Integer | `[1: Integer.MAX_VALUE]` | No | 1 |
+| `on-success` | Action for successfully loaded TsFiles: `delete` (delete the TsFile after successful import) or `none` (retain the TsFile in the source folder). | String | `delete / none` | No | delete |
+| `model` | Specifies whether the TsFile uses the `table` model or `tree` model. | String | `tree / table` | No | Aligns with `-sql_dialect` |
+| `database-name` | Table model only: Target database for import. Automatically created if it does not exist. The database-name must not include the `root.` prefix (an error will occur if included). | String | `-` | No | null |
+| `convert-on-type-mismatch` | Whether to perform type conversion during loading if data types in the TsFile mismatch the target schema. | Boolean | `true / false` | No | true |
+| `verify` | Whether to validate the schema before loading the TsFile. | Boolean | `true / false` | No | true |
+| `tablet-conversion-threshold` | Size threshold (in bytes) for converting TsFiles into tablet format during loading. Default: `-1` (no conversion for any TsFile). | Integer | `[-1,0 :``Integer.MAX_VALUE]` | No | -1 |
+| `async` | Whether to enable asynchronous loading. If enabled, TsFiles are moved to an active-load directory and loaded into the `database-name` asynchronously. | Boolean | `true / false` | No | false |
+
+### 4.2 Example
+
+```SQL
+-- Before import
+IoTDB> show databases
++-------------+-----------------------+---------------------+-------------------+---------------------+
+| Database|SchemaReplicationFactor|DataReplicationFactor|TimePartitionOrigin|TimePartitionInterval|
++-------------+-----------------------+---------------------+-------------------+---------------------+
+|root.__system| 1| 1| 0| 604800000|
++-------------+-----------------------+---------------------+-------------------+---------------------+
+
+-- Import tsfile by excuting load sql
+IoTDB> load '/home/dump1.tsfile' with ( 'on-success'='none')
+Msg: The statement is executed successfully.
+
+-- Verify whether the import was successful
+IoTDB> select * from root.testdb.**
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+| Time|root.testdb.device.model.temperature|root.testdb.device.model.humidity|root.testdb.device.model.status|
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+|2025-04-17T10:35:47.218+08:00| 22.3| 19.4| true|
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+```
\ No newline at end of file
diff --git a/src/UserGuide/latest-Table/Tools-System/Data-Import-Tool.md b/src/UserGuide/latest-Table/Tools-System/Data-Import-Tool.md
index b56e4a4a0..726ada898 100644
--- a/src/UserGuide/latest-Table/Tools-System/Data-Import-Tool.md
+++ b/src/UserGuide/latest-Table/Tools-System/Data-Import-Tool.md
@@ -1,7 +1,11 @@
# Data Import
## 1. Functional Overview
-The data import tool `import-data.sh/bat` is located in the `tools` directory and can import data in CSV, SQL, and TsFile (an open-source time-series file format) into IoTDB. Its specific functionalities are as follows:
+
+IoTDB supports three methods for data import:
+- Data Import Tool: Use the `import-data.sh/bat` script in the `tools` directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
+- `TsFile` Auto-Loading Feature
+- Load `TsFile` SQL
@@ -19,13 +23,21 @@ The data import tool `import-data.sh/bat` is located in the `tools` directory an
Can be used for single or batch import of SQL files into IoTDB
-
TsFile
+
TsFile
Can be used for single or batch import of TsFile files into IoTDB
-
+
+
+
TsFile Auto-Loading Feature
+
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB
+
+
+
Load SQL
+
Can be used for single or batch import of TsFile files into IoTDB
+
-## 2. Detailed Features
+## 2. Data Import Tool
### 2.1 Common Parameters
| Short | Full Parameter | Description | Required | Default |
@@ -183,3 +195,105 @@ Fail to insert measurements '[column.name]' caused by [data type is not consiste
> tools/import-data.sh -ft tsfile -sql_dialect table -s ./tsfile -db database1
Parse error: Missing required options: os, of
```
+
+## 3. TsFile Auto-Loading
+
+This feature enables IoTDB to automatically monitor a specified directory for new TsFiles and load them into the database without manual intervention.
+
+
+
+### 3.1 Configuration
+
+Add the following parameters to `iotdb-system.properties` (template: `iotdb-system.properties.template`):
+
+| Parameter | Description | Value Range | Required | Default | Hot-Load? |
+| ---------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------| ---------- | ----------------------------- | ----------------------- |
+| `load_active_listening_enable` | Enable auto-loading. | `true`/`false` | Optional | `true` | Yes |
+| `load_active_listening_dirs` | Directories to monitor (subdirectories included). Multiple paths separated by commas. Note: In the table model, the directory name where the file is located will be used as the database. | String | Optional | `ext/load/pending` | Yes |
+| `load_active_listening_fail_dir` | Directory to store failed TsFiles. Only can set one. | String | Optional | `ext/load/failed` | Yes |
+| `load_active_listening_max_thread_num` | Maximum Threads for TsFile Loading Tasks:The default value for this parameter, when commented out, is max(1, CPU cores / 2). If the value set by the user falls outside the range [1, CPU cores / 2], it will be reset to the default value of max(1, CPU cores / 2). | `1` to `Long.MAX_VALUE` | Optional | `max(1, CPU_CORES / 2)` | No (restart required) |
+| `load_active_listening_check_interval_seconds` | Active Listening Polling Interval (in seconds):The active listening feature for TsFiles is implemented through polling the target directory. This configuration specifies the time interval between two consecutive checks of the `load_active_listening_dirs`. After each check, the next check will be performed after `load_active_listening_check_interval_seconds` seconds. If the polling interval set by the user is less than 1, it will be reset to the default value of 5 seconds. | `1` to `Long.MAX_VALUE` | Optional | `5` | No (restart required) |
+
+### 3.2 Examples
+
+```bash
+load_active_listening_dir/
+├─sensors/
+│ ├─temperature/
+│ │ └─temperature-table.TSFILE
+
+```
+
+- Table model TsFile
+ - `temperature-table.TSFILE`: will be imported into the `temperature` database (because it is located in the `sensors/temperature/` directory)
+
+
+### 3.3 Notes
+
+1. **Mods Files**: If TsFiles have associated `.mods` files, move `.mods` files to the monitored directory **before** their corresponding TsFiles. Ensure `.mods` and TsFiles are in the same directory.
+2. **Restricted Directories**: Do NOT set Pipe receiver directories, data directories, or other system paths as monitored directories.
+3. **Directory Conflicts**: Ensure `load_active_listening_fail_dir` does not overlap with `load_active_listening_dirs` or its subdirectories.
+4. **Permissions**: The monitored directory must have write permissions. Files are deleted after successful loading; insufficient permissions may cause duplicate loading.
+
+
+## 4. Load SQL
+
+IoTDB supports importing one or multiple TsFile files containing time series into another running IoTDB instance directly via SQL execution through the CLI.
+
+### 4.1 Command
+
+```SQL
+load '' with (
+ 'attribute-key1'='attribute-value1',
+ 'attribute-key2'='attribute-value2',
+)
+```
+
+* `` : The path to a TsFile or a folder containing multiple TsFiles.
+* ``: Optional parameters, as described below.
+
+| Key | Key Description | Value Type | Value Range | Value is Required | Default Value |
+|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------|-------------------|----------------------------|
+| `database-level` | When the database corresponding to the TsFile does not exist, the database hierarchy level can be specified via the ` database-level` parameter. The default is the level set in `iotdb-common.properties`. For example, setting level=1 means the prefix path of level 1 in all time series in the TsFile will be used as the database. | Integer | `[1: Integer.MAX_VALUE]` | No | 1 |
+| `on-success` | Action for successfully loaded TsFiles: `delete` (delete the TsFile after successful import) or `none` (retain the TsFile in the source folder). | String | `delete / none` | No | delete |
+| `model` | Specifies whether the TsFile uses the `table` model or `tree` model. | String | `tree / table` | No | Aligns with `-sql_dialect` |
+| `database-name` | Table model only: Target database for import. Automatically created if it does not exist. The database-name must not include the `root.` prefix (an error will occur if included). | String | `-` | No | null |
+| `convert-on-type-mismatch` | Whether to perform type conversion during loading if data types in the TsFile mismatch the target schema. | Boolean | `true / false` | No | true |
+| `verify` | Whether to validate the schema before loading the TsFile. | Boolean | `true / false` | No | true |
+| `tablet-conversion-threshold` | Size threshold (in bytes) for converting TsFiles into tablet format during loading. Default: `-1` (no conversion for any TsFile). | Integer | `[-1,0 :``Integer.MAX_VALUE]` | No | -1 |
+| `async` | Whether to enable asynchronous loading. If enabled, TsFiles are moved to an active-load directory and loaded into the `database-name` asynchronously. | Boolean | `true / false` | No | false |
+
+### 4.2 Example
+
+```SQL
+-- Create target database: database2
+IoTDB> create database database2
+Msg: The statement is executed successfully.
+
+IoTDB> use database2
+Msg: The statement is executed successfully.
+
+IoTDB:database2> show tables details
++---------+-------+------+-------+
+|TableName|TTL(ms)|Status|Comment|
++---------+-------+------+-------+
++---------+-------+------+-------+
+Empty set.
+
+-- Import tsfile by excuting load sql
+IoTDB:database2> load '/home/dump0.tsfile' with ( 'on-success'='none', 'database-name'='database2')
+Msg: The statement is executed successfully.
+
+-- Verify whether the import was successful
+IoTDB:database2> select * from table2
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+| time|region|plant_id|device_id|temperature|humidity|status| arrival_time|
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+|2024-11-30T00:00:00.000+08:00| 上海| 3002| 101| 90.0| 35.2| true| null|
+|2024-11-29T00:00:00.000+08:00| 上海| 3001| 101| 85.0| 35.1| null|2024-11-29T10:00:13.000+08:00|
+|2024-11-27T00:00:00.000+08:00| 北京| 1001| 101| 85.0| 35.1| true|2024-11-27T16:37:01.000+08:00|
+|2024-11-29T11:00:00.000+08:00| 上海| 3002| 100| null| 45.1| true| null|
+|2024-11-28T08:00:00.000+08:00| 上海| 3001| 100| 85.0| 35.2| false|2024-11-28T08:00:09.000+08:00|
+|2024-11-26T13:37:00.000+08:00| 北京| 1001| 100| 90.0| 35.1| true|2024-11-26T13:37:34.000+08:00|
++-----------------------------+------+--------+---------+-----------+--------+------+-----------------------------+
+```
diff --git a/src/UserGuide/latest/Tools-System/Data-Import-Tool.md b/src/UserGuide/latest/Tools-System/Data-Import-Tool.md
index 1f5f83c01..4387a9aea 100644
--- a/src/UserGuide/latest/Tools-System/Data-Import-Tool.md
+++ b/src/UserGuide/latest/Tools-System/Data-Import-Tool.md
@@ -1,9 +1,10 @@
# Data Import
## 1. Overview
-IoTDB supports two methods for data import:
-* Data Import Tool: Use the import-data.sh (Unix/OS X) or import-data.bat (Windows) script in the tools directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
-* TsFile Auto-Loading Feature
+IoTDB supports three methods for data import:
+- Data Import Tool: Use the `import-data.sh/bat` script in the `tools` directory to manually import CSV, SQL, or TsFile (open-source time-series file format) data into IoTDB.
+- `TsFile` Auto-Loading Feature
+- Load `TsFile` SQL
@@ -21,12 +22,16 @@ IoTDB supports two methods for data import:
Can be used for single or batch import of SQL files into IoTDB
-
TsFile
+
TsFile
Can be used for single or batch import of TsFile files into IoTDB
-
TsFile Auto-Loading Feature
-
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB.
+
TsFile Auto-Loading Feature
+
Can automatically monitor a specified directory for newly generated TsFiles and load them into IoTDB
+
+
+
Load SQL
+
Can be used for single or batch import of TsFile files into IoTDB
@@ -242,3 +247,54 @@ Add the following parameters to `iotdb-system.properties` (template: `iotdb-syst
2. **Restricted Directories**: Do NOT set Pipe receiver directories, data directories, or other system paths as monitored directories.
3. **Directory Conflicts**: Ensure `load_active_listening_fail_dir` does not overlap with `load_active_listening_dirs` or its subdirectories.
4. **Permissions**: The monitored directory must have write permissions. Files are deleted after successful loading; insufficient permissions may cause duplicate loading.
+
+## 4. Load SQL
+
+IoTDB supports importing one or multiple TsFile files containing time series into another running IoTDB instance directly via SQL execution through the CLI.
+
+### 4.1 Command
+
+```SQL
+load '' with (
+ 'attribute-key1'='attribute-value1',
+ 'attribute-key2'='attribute-value2',
+)
+```
+
+* `` : The path to a TsFile or a folder containing multiple TsFiles.
+* ``: Optional parameters, as described below.
+
+| Key | Key Description | Value Type | Value Range | Value is Required | Default Value |
+|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------|-------------------|----------------------------|
+| `database-level` | When the database corresponding to the TsFile does not exist, the database hierarchy level can be specified via the ` database-level` parameter. The default is the level set in `iotdb-common.properties`. For example, setting level=1 means the prefix path of level 1 in all time series in the TsFile will be used as the database. | Integer | `[1: Integer.MAX_VALUE]` | No | 1 |
+| `on-success` | Action for successfully loaded TsFiles: `delete` (delete the TsFile after successful import) or `none` (retain the TsFile in the source folder). | String | `delete / none` | No | delete |
+| `model` | Specifies whether the TsFile uses the `table` model or `tree` model. | String | `tree / table` | No | Aligns with `-sql_dialect` |
+| `database-name` | Table model only: Target database for import. Automatically created if it does not exist. The database-name must not include the `root.` prefix (an error will occur if included). | String | `-` | No | null |
+| `convert-on-type-mismatch` | Whether to perform type conversion during loading if data types in the TsFile mismatch the target schema. | Boolean | `true / false` | No | true |
+| `verify` | Whether to validate the schema before loading the TsFile. | Boolean | `true / false` | No | true |
+| `tablet-conversion-threshold` | Size threshold (in bytes) for converting TsFiles into tablet format during loading. Default: `-1` (no conversion for any TsFile). | Integer | `[-1,0 :``Integer.MAX_VALUE]` | No | -1 |
+| `async` | Whether to enable asynchronous loading. If enabled, TsFiles are moved to an active-load directory and loaded into the `database-name` asynchronously. | Boolean | `true / false` | No | false |
+
+### 4.2 Example
+
+```SQL
+-- Before import
+IoTDB> show databases
++-------------+-----------------------+---------------------+-------------------+---------------------+
+| Database|SchemaReplicationFactor|DataReplicationFactor|TimePartitionOrigin|TimePartitionInterval|
++-------------+-----------------------+---------------------+-------------------+---------------------+
+|root.__system| 1| 1| 0| 604800000|
++-------------+-----------------------+---------------------+-------------------+---------------------+
+
+-- Import tsfile by excuting load sql
+IoTDB> load '/home/dump1.tsfile' with ( 'on-success'='none')
+Msg: The statement is executed successfully.
+
+-- Verify whether the import was successful
+IoTDB> select * from root.testdb.**
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+| Time|root.testdb.device.model.temperature|root.testdb.device.model.humidity|root.testdb.device.model.status|
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+|2025-04-17T10:35:47.218+08:00| 22.3| 19.4| true|
++-----------------------------+------------------------------------+---------------------------------+-------------------------------+
+```
\ No newline at end of file
diff --git a/src/zh/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md b/src/zh/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
index b77509a3f..738b440d4 100644
--- a/src/zh/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
+++ b/src/zh/UserGuide/Master/Table/Tools-System/Data-Import-Tool.md
@@ -2,7 +2,10 @@
## 1. 功能概述
-数据导出工具 `import-data.sh/bat` 位于 `tools` 目录下,可以将 CSV、SQL、及 TsFile(开源时序文件格式)的数据导入 IoTDB。具体功能如下:
+IoTDB 支持三种方式进行数据导入:
+- 数据导入工具 :`import-data.sh/bat` 位于 `tools` 目录下,可以将 `CSV`、`SQL`、及`TsFile`(开源时序文件格式)的数据导入 `IoTDB`。
+- `TsFile` 自动加载功能。
+- `Load SQL` 导入 `TsFile` 。