Documentation

Write to Snowflake

To write data to Snowflake with Flux:

  1. Import the sql package.

  2. Pipe-forward data into sql.to() and provide the following parameters:

    • driverName: snowflake
    • dataSourceName: See data source name
    • table: Table to write to
    • batchSize: Number of parameters or columns that can be queued within each call to Exec (default is 10000)
import "sql"
  
data
  |> sql.to(
    driverName: "snowflake",
    dataSourceName: "user:password@account/db/exampleschema?warehouse=wh",
    table: "example_table"
  )

Snowflake data source name

The snowflake driver uses the following DSN syntaxes (also known as a connection string):

username[:password]@accountname/dbname/schemaname?param1=value1&paramN=valueN
username[:password]@accountname/dbname?param1=value1&paramN=valueN
username[:password]@hostname:port/dbname/schemaname?account=<your_account>&param1=value1&paramN=valueN

Flux to Snowflake data type conversion

sql.to() converts Flux data types to Snowflake data types.

Flux data type Snowflake data type
float FLOAT
int NUMBER
string TEXT
bool BOOLEAN
time TIMESTAMP_LTZ

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.