docs(outputs.sql): improve the documentation (#13385)

This commit is contained in:
Dawid Wołosowicz 2023-06-05 15:42:44 +02:00 committed by GitHub
parent 28073ab034
commit 536ab9e7b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -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
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
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
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
[outputs.sql.convert]
conversion_style = "literal"
integer = "Int64"
text = "String"
timestamp = "DateTime"
defaultvalue = "String"
unsigned = "UInt64"
bool = "UInt8"
real = "Float64"
```
See [ClickHouse data