You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data export tool, export-data.sh (Unix/OS X) or export-data.bat (Windows), located in the tools directory, allows users to export query results from specified SQL statements into CSV, SQL, or TsFile (open-source time-series file format) formats. The 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.
SQL
File containing custom SQL statements.
TsFile
Open-source time-series file format.
2. Detailed Functionality
2.1 Common Parameters
Short
Full Parameter
Description
Required
Default
-ft
--file_type
Export file type: csv, sql, tsfile.
Yes
-
-h
--host
Hostname of the IoTDB server.
No
127.0.0.1
-p
--port
Port number of the IoTDB server.
No
6667
-u
--username
Username for authentication.
No
root
-pw
--password
Password for authentication.
No
TimechoDB@2021(Before V2.0.6 it is root )
-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.
No
ISO8601
-tz
--timezone
Timezone setting (e.g., +08:00, -01:00).
No
System default
2.2.3 Examples
# Valid Example> tools/export-data.sh -ft csv -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@2021 -t /path/export/dir
-pfn exported-data.csv -dt true -lpf 1000 -tf "yyyy-MM-dd HH:mm:ss"
-tz +08:00 -q "SELECT * FROM root.ln" -timeout 20000
# Error Example> tools/export-data.sh -ft csv -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@2021
Parse error: Missing required option: t
# Note: Before version V2.0.6, the default value for the -pw parameter was root.
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.
No
ISO8601
-tz
--timezone
Timezone setting (e.g., +08:00, -01:00).
No
System default
2.3.3 Examples
# Valid Example> tools/export-data.sh -ft sql -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@2021 -t /path/export/dir
-pfn exported-data.csv -aligned true -lpf 1000 -tf "yyyy-MM-dd HH:mm:ss"
-tz +08:00 -q "SELECT * FROM root.ln" -timeout 20000
# Error Example> tools/export-data.sh -ft sql -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@2021
Parse error: Missing required option: t
# Note: Before version V2.0.6, the default value for the -pw parameter was root.