16 releases (5 breaking)

new 0.6.3 Nov 4, 2024
0.6.1 Sep 5, 2024
0.5.1 Jun 13, 2024
0.2.0 Mar 14, 2024
0.1.0 Dec 4, 2023

#743 in Database interfaces

Download history 336/week @ 2024-07-19 727/week @ 2024-07-26 2215/week @ 2024-08-02 1108/week @ 2024-08-09 778/week @ 2024-08-16 670/week @ 2024-08-23 927/week @ 2024-08-30 945/week @ 2024-09-06 589/week @ 2024-09-13 724/week @ 2024-09-20 735/week @ 2024-09-27 701/week @ 2024-10-04 622/week @ 2024-10-11 476/week @ 2024-10-18 542/week @ 2024-10-25 701/week @ 2024-11-01

2,393 downloads per month

MIT license

39KB
920 lines

Snowflake Connector for Rust

test Crates.io

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");

Dependencies

~12–24MB
~363K SLoC