docs(outputs.sql): improve the documentation (#13385)
This commit is contained in:
parent
28073ab034
commit
536ab9e7b2
|
|
@ -34,6 +34,12 @@ database drivers use question marks as placeholders but postgres uses indexed
|
||||||
dollar signs. The plugin chooses which placeholder style to use depending on the
|
dollar signs. The plugin chooses which placeholder style to use depending on the
|
||||||
driver selected.
|
driver selected.
|
||||||
|
|
||||||
|
Through the nature of the inputs plugins, the amounts of columns inserted within
|
||||||
|
rows for a given metric may differ. Since the tables are created based on the
|
||||||
|
tags and fields available within an input metric, it's possible the created
|
||||||
|
table won't contain all the neccessary columns. You might need to initialize
|
||||||
|
the schema yourself, to avoid this scenario.
|
||||||
|
|
||||||
## Advanced options
|
## Advanced options
|
||||||
|
|
||||||
When the plugin first connects it runs SQL from the init_sql setting, allowing
|
When the plugin first connects it runs SQL from the init_sql setting, allowing
|
||||||
|
|
@ -175,16 +181,28 @@ docs](https://modernc.org/sqlite) for details.
|
||||||
|
|
||||||
### clickhouse
|
### clickhouse
|
||||||
|
|
||||||
Use this metric type to SQL type conversion:
|
#### DSN
|
||||||
|
|
||||||
|
Currently, Telegraf's sql output plugin depends on
|
||||||
|
[clickhouse-go v1.5.4](https://github.com/ClickHouse/clickhouse-go/tree/v1.5.4)
|
||||||
|
which uses a [different DSN
|
||||||
|
format](https://github.com/ClickHouse/clickhouse-go/tree/v1.5.4#dsn) than its
|
||||||
|
newer `v2.*` version.
|
||||||
|
|
||||||
|
#### Metric type to SQL type conversion
|
||||||
|
|
||||||
|
The following configuration makes the mapping compatible with Clickhouse:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[outputs.sql.convert]
|
[outputs.sql.convert]
|
||||||
|
conversion_style = "literal"
|
||||||
integer = "Int64"
|
integer = "Int64"
|
||||||
text = "String"
|
text = "String"
|
||||||
timestamp = "DateTime"
|
timestamp = "DateTime"
|
||||||
defaultvalue = "String"
|
defaultvalue = "String"
|
||||||
unsigned = "UInt64"
|
unsigned = "UInt64"
|
||||||
bool = "UInt8"
|
bool = "UInt8"
|
||||||
|
real = "Float64"
|
||||||
```
|
```
|
||||||
|
|
||||||
See [ClickHouse data
|
See [ClickHouse data
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue