Skip to main content

Crate snowflake_connector_rs

Crate snowflake_connector_rs 

Source
Expand description

§Snowflake Connector

A Rust client for Snowflake, which enables you to connect to Snowflake and run queries.

let client = SnowflakeClient::new(
    "USERNAME",
    SnowflakeAuthMethod::Password("PASSWORD".to_string()),
    SnowflakeClientConfig {
        account: "ACCOUNT".to_string(),
        role: Some("ROLE".to_string()),
        warehouse: Some("WAREHOUSE".to_string()),
        database: Some("DATABASE".to_string()),
        schema: Some("SCHEMA".to_string()),
        timeout: Some(std::time::Duration::from_secs(30)),
    },
)?;
let session = client.create_session().await?;

let query = "CREATE TEMPORARY TABLE example (id NUMBER, value STRING)";
session.query(query).await?;

let query = "INSERT INTO example (id, value) VALUES (1, 'hello'), (2, 'world')";
session.query(query).await?;

let query = "SELECT * FROM example ORDER BY id";
let rows = session.query(query).await?;
assert_eq!(rows.len(), 2);
assert_eq!(rows[0].get::<i64>("ID")?, 1);
assert_eq!(rows[0].get::<String>("VALUE")?, "hello");

Structs§

Binding
A single bind parameter for a Snowflake query.
QueryExecutor
QueryRequest
SnowflakeClient
SnowflakeClientConfig
SnowflakeColumn
Represents a Snowflake database column with its metadata.
SnowflakeColumnType
Represents the type information of a Snowflake column.
SnowflakeRow
SnowflakeSession
WithCallbackListenerConfig
WithoutCallbackListenerConfig

Enums§

BindingType
Snowflake bind parameter type.
BrowserLaunchMode
Controls how the SSO URL is opened.
Error
An error that can occur when interacting with Snowflake.
ExternalBrowserConfig
Configuration for SnowflakeAuthMethod::ExternalBrowser.
SnowflakeAuthMethod

Traits§

SnowflakeDecode

Type Aliases§

Result
A Result alias where the Err case is snowflake::Error.