|
| 1 | +<!-- |
| 2 | +
|
| 3 | + Licensed to the Apache Software Foundation (ASF) under one |
| 4 | + or more contributor license agreements. See the NOTICE file |
| 5 | + distributed with this work for additional information |
| 6 | + regarding copyright ownership. The ASF licenses this file |
| 7 | + to you under the Apache License, Version 2.0 (the |
| 8 | + "License"); you may not use this file except in compliance |
| 9 | + with the License. You may obtain a copy of the License at |
| 10 | + |
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + |
| 13 | + Unless required by applicable law or agreed to in writing, |
| 14 | + software distributed under the License is distributed on an |
| 15 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | + KIND, either express or implied. See the License for the |
| 17 | + specific language governing permissions and limitations |
| 18 | + under the License. |
| 19 | +
|
| 20 | +--> |
| 21 | + |
| 22 | +# Metadata Import |
| 23 | + |
| 24 | +## 1. Overview |
| 25 | + |
| 26 | +The metadata import tool `import-schema.sh/bat` is located in the `tools` directory. It can import CSV files containing metadata creation statements from a specified path into IoTDB. |
| 27 | + |
| 28 | +> Supported since version 1.3.3 |
| 29 | +
|
| 30 | +## 2. Detailed Functionality |
| 31 | + |
| 32 | +### 2.1 Parameter Description |
| 33 | + |
| 34 | +| Short Parameter | Full Parameter | Description | Required | Default Value | |
| 35 | +|-----------------|----------------|-------------|----------|---------------| |
| 36 | +| `-h` | `--host` | Hostname | No | 127.0.0.1 | |
| 37 | +| `-p` | `--port` | Port number | No | 6667 | |
| 38 | +| `-u` | `--username` | Username | No | root | |
| 39 | +| `-pw` | `--password` | Password | No | root | |
| 40 | +| `-s` | `--source` | Local path of the script file or directory to be loaded | Yes | - | |
| 41 | +| `-fd` | `--fail_dir` | Specifies the directory to save failed files | No | - | |
| 42 | +| `-lpf` | `--lines_per_failed_file` | Specifies the maximum number of lines per failed file | No | 100000. Range: 0 ~ Integer.MAX_VALUE = 2147483647 | |
| 43 | +| `-help` | `--help` | Displays help information | No | - | |
| 44 | + |
| 45 | +### 2.2 Execution Commands |
| 46 | + |
| 47 | +```Bash |
| 48 | +# Unix/OS X |
| 49 | +tools/import-schema.sh [-h <host>] [-p <port>] [-u <username>] [-pw <password>] -s |
| 50 | + <sourceDir/sourceFile> [-fd <failDir>] [-batch <batchSize>] [-lpf <linesPerFile>] [-help] |
| 51 | + |
| 52 | +# Windows |
| 53 | +tools\import-schema.bat [-h <host>] [-p <port>] [-u <username>] [-pw <password>] -s |
| 54 | + <sourceDir/sourceFile> [-fd <failDir>] [-batch <batchSize>] [-lpf <linesPerFile>] [-help] |
| 55 | +``` |
| 56 | + |
| 57 | +### 2.3 Usage Example |
| 58 | + |
| 59 | +```SQL |
| 60 | +-- Before import |
| 61 | +IoTDB> show timeseries root.ln.** |
| 62 | ++----------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 63 | +|Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| |
| 64 | ++----------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 65 | ++----------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 66 | +``` |
| 67 | + |
| 68 | +```Bash |
| 69 | +# Execute the import command |
| 70 | +./import-schema.sh -s /home/dump0_0.csv |
| 71 | +``` |
| 72 | + |
| 73 | +```SQL |
| 74 | +-- Verify after successful import |
| 75 | +IoTDB> show timeseries root.ln.** |
| 76 | ++--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 77 | +| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType| |
| 78 | ++--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 79 | +| root.ln.wf02.wt02.status| null| root.ln| BOOLEAN| RLE| LZ4|null| null| null| null| BASE| |
| 80 | +|root.ln.wf02.wt02.hardware| null| root.ln| TEXT| PLAIN| LZ4|null| null| null| null| BASE| |
| 81 | ++--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+ |
| 82 | +``` |
0 commit comments