> For the complete documentation index, see [llms.txt](https://docs.selfuel.digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.selfuel.digital/data-integration-with-nexus/nexus-elements/connectors/source/influxdb.md).

# InfluxDB

> InfluxDB source connector

### Description[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#description) <a href="#description" id="description"></a>

Read external data source data through InfluxDB.

### Key features[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#key-features) <a href="#key-features" id="key-features"></a>

* [x] &#x20;batch
* [ ] &#x20;stream
* [x] &#x20;exactly-once
* [x] &#x20;column projection

supports query SQL and can achieve projection effect.

* [x] &#x20;parallelism
* [ ] &#x20;support user-defined split

### Options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#options) <a href="#options" id="options"></a>

| name                 | type   | required | default value |
| -------------------- | ------ | -------- | ------------- |
| url                  | string | yes      | -             |
| sql                  | string | yes      | -             |
| schema               | config | yes      | -             |
| database             | string | yes      |               |
| username             | string | no       | -             |
| password             | string | no       | -             |
| lower\_bound         | long   | no       | -             |
| upper\_bound         | long   | no       | -             |
| partition\_num       | int    | no       | -             |
| split\_column        | string | no       | -             |
| epoch                | string | no       | n             |
| connect\_timeout\_ms | long   | no       | 15000         |
| query\_timeout\_sec  | int    | no       | 3             |
| common-options       | config | no       | -             |

#### url[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#url) <a href="#url" id="url"></a>

the url to connect to influxDB e.g.

```
http://influxdb-host:8086
```

#### sql \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#sql-string) <a href="#sql-string" id="sql-string"></a>

The query sql used to search data

```
select name,age from test
```

#### schema \[config][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#schema-config) <a href="#schema-config" id="schema-config"></a>

**fields \[Config]**[**​**](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#fields-config)

The schema information of upstream data. e.g.

```
schema {
    fields {
        name = string
        age = int
    }
  }
```

#### database \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#database-string) <a href="#database-string" id="database-string"></a>

The `influxDB` database

#### username \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#username-string) <a href="#username-string" id="username-string"></a>

the username of the influxDB when you select

#### password \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#password-string) <a href="#password-string" id="password-string"></a>

the password of the influxDB when you select

#### split\_column \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#split_column-string) <a href="#split_column-string" id="split_column-string"></a>

the `split_column` of the influxDB when you select

> Tips:
>
> * influxDB tags is not supported as a segmented primary key because the type of tags can only be a string
> * influxDB time is not supported as a segmented primary key because the time field cannot participate in mathematical calculation
> * Currently, `split_column` only supports integer data segmentation, and does not support `float`, `string`, `date` and other types.

#### upper\_bound \[long][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#upper_bound-long) <a href="#upper_bound-long" id="upper_bound-long"></a>

upper bound of the `split_column`column

#### lower\_bound \[long][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#lower_bound-long) <a href="#lower_bound-long" id="lower_bound-long"></a>

lower bound of the `split_column` column

```
     split the $split_column range into $partition_num parts
     if partition_num is 1, use the whole `split_column` range
     if partition_num < (upper_bound - lower_bound), use (upper_bound - lower_bound) partitions
     
     eg: lower_bound = 1, upper_bound = 10, partition_num = 2
     sql = "select * from test where age > 0 and age < 10"
     
     split result

     split 1: select * from test where ($split_column >= 1 and $split_column < 6)  and (  age > 0 and age < 10 )
     
     split 2: select * from test where ($split_column >= 6 and $split_column < 11) and (  age > 0 and age < 10 )

```

#### partition\_num \[int][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#partition_num-int) <a href="#partition_num-int" id="partition_num-int"></a>

the `partition_num` of the InfluxDB when you select

> Tips: Ensure that `upper_bound` minus `lower_bound` is divided `bypartition_num`, otherwise the query results will overlap

#### epoch \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#epoch-string) <a href="#epoch-string" id="epoch-string"></a>

returned time precision

* Optional values: H, m, s, MS, u, n
* default value: n

#### query\_timeout\_sec \[int][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#query_timeout_sec-int) <a href="#query_timeout_sec-int" id="query_timeout_sec-int"></a>

the `query_timeout` of the InfluxDB when you select, in seconds

#### connect\_timeout\_ms \[long][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#connect_timeout_ms-long) <a href="#connect_timeout_ms-long" id="connect_timeout_ms-long"></a>

the timeout for connecting to InfluxDB, in milliseconds

#### common options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#common-options) <a href="#common-options" id="common-options"></a>

Source plugin common parameters, please refer to [Source Common Options](/data-integration-with-nexus/nexus-elements/connectors/source/source-common-options.md) for details

### Examples[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/InfluxDB#examples) <a href="#examples" id="examples"></a>

Example of multi parallelism and multi partition scanning

```
source {

    InfluxDB {
        url = "http://influxdb-host:8086"
        sql = "select label, value, rt, time from test"
        database = "test"
        upper_bound = 100
        lower_bound = 1
        partition_num = 4
        split_column = "value"
        schema {
            fields {
                label = STRING
                value = INT
                rt = STRING
                time = BIGINT
            }
    }

}

```

Example of not using partition scan

```
source {

    InfluxDB {
        url = "http://influxdb-host:8086"
        sql = "select label, value, rt, time from test"
        database = "test"
        schema {
            fields {
                label = STRING
                value = INT
                rt = STRING
                time = BIGINT
            }
    }

}
```
