Write to Snowflake
To write data to Snowflake with Flux:
-
Import the
sql
package. -
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 is10000
)
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¶mN=valueN
username[:password]@accountname/dbname?param1=value1¶mN=valueN
username[:password]@hostname:port/dbname/schemaname?account=<your_account>¶m1=value1¶mN=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 |
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.