The data export tool export-data.sh/bat is located in the tools directory and can export query results from specified SQL statements into CSV, SQL, or TsFile (open-source time-series file format) formats. Its specific functionalities are as follows:
File Format
IoTDB Tool
Description
CSV
export-data.sh/bat
Plain text format for storing structured data. Must follow the CSV format specified below.
The target database to be exported only takes effect when -sql_dialect is of the table type.
Yes when -sql_dialect = table
-
-table
--table
The target table to be exported only takes effect when -sql_dialect is of the table type. If the -q parameter is specified, this parameter will not take effect. If the export type is tsfile/sql, this parameter is mandatory.
No
-
-start_time
--start_time
The start time of the data to be exported only takes effect when -sql_dialect is of the table type. If -q is specified, this parameter will not take effect. The supported time formats are the same as those for the -tf parameter.
No
-
-end_time
--end_time
The end time of the data to be exported only takes effect when -sql_dialect is set to the table type. If -q is specified, this parameter will not take effect.
No
-
-t
--target
Target directory for the output files. If the path does not exist, it will be created.
Yes
-
-pfn
--prefix_file_name
Prefix for the exported file names. For example, abc will generate files like abc_0.tsfile, abc_1.tsfile.
Whether to include data types in the CSV file header (true or false).
No
false
-lpf
--lines_per_file
Number of rows per exported file.
No
10000 (Range:0~Integer.Max=2147483647)
-tf
--time_format
Time format for the CSV file. Options: 1) Timestamp (numeric, long), 2) ISO8601 (default), 3) Custom pattern (e.g., yyyy-MM-dd HH:mm:ss). SQL file timestamps are unaffected by this setting.
Whether to export as aligned SQL format (true or false).
No
true
-lpf
--lines_per_file
Number of rows per exported file.
No
10000 (Range:0~Integer.Max=2147483647)
-tf
--time_format
Time format for the CSV file. Options: 1) Timestamp (numeric, long), 2) ISO8601 (default), 3) Custom pattern (e.g., yyyy-MM-dd HH:mm:ss). SQL file timestamps are unaffected by this setting.