content/flux/v0/write-data/sql/vertica.md
To write data to Vertica with Flux:
Import the sql package.
Pipe-forward data into sql.to() and provide
the following parameters:
Exec (default is 10000)import "sql"
data
|> sql.to(
driverName: "vertica",
dataSourceName: "vertica://username:password@localhost:5433/dbname",
table: "public.example_table",
)
The vertica and vertigo drivers use the following DSN syntax (also known as a connection string):
vertica://<user>:<password>@<host>:<port>/<database>?<queryArgs>
The vertica and vertigo drivers use the vertica/vertica-sql-go implementation.
For information about supported DSN query arguments, see the
vertica/vertica-sql-go documentation.
sql.to() converts Flux data types to Vertica data types.
| Flux data type | Vertica data type |
|---|---|
| float | FLOAT |
| int | INTEGER |
| uint | INTEGER |
| string | VARCHAR |
| bool | BOOL |
| time | TIMESTAMP |