Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions plugins/outputs/sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,44 @@ types](https://clickhouse.com/docs/en/sql-reference/data-types/) for more info.
Telegraf doesn't have unit tests for go-mssqldb so it should be treated as
experimental.

#### DSN

The following format for the DSN applies to mssql. For more information and
additional configuration options refer to the [go-mssql documentation][go-mssqldb-doc].

[go-mssqldb-doc]: https://pkg.go.dev/github.com/microsoft/go-mssqldb

```toml
data_source_name = "sqlserver://username:password@host/instance?database=dbname"
```

#### Templates

The following templates are compatible with mssql

```toml
table_template = "CREATE TABLE {TABLE}({COLUMNS})"
table_exists_template = "SELECT TOP 1 1 FROM {TABLE}"
table_update_template = "ALTER TABLE {TABLE} ADD {COLUMN}"

```

#### Metric type to SQL type conversion

The following configuration makes the mapping compatible with mssql:

```toml
[outputs.sql.convert]
integer = "INT"
real = "REAL"
text = "TEXT"
timestamp = "DATETIMEOFFSET"
defaultvalue = "TEXT"
unsigned = "BIGINT"
bool = "BIT"
conversion_style = "literal"
```

### snowflakedb/gosnowflake

Telegraf doesn't have unit tests for gosnowflake so it should be treated as
Expand Down
Loading