Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/estie-inc/snowflake-connector-rs

Snowflake Connector for Rust
https://github.com/estie-inc/snowflake-connector-rs

Last synced: about 2 months ago
JSON representation

Snowflake Connector for Rust

Awesome Lists containing this project

README

        

# Snowflake Connector for Rust

[![test](https://github.com/estie-inc/snowflake-connector-rs/actions/workflows/test.yml/badge.svg)](https://github.com/estie-inc/snowflake-connector-rs/actions/workflows/test.yml)
[![Crates.io](https://img.shields.io/crates/v/snowflake-connector-rs)](https://crates.io/crates/snowflake-connector-rs)

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

```rust
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::("ID")?, 1);
assert_eq!(rows[0].get::("VALUE")?, "hello");
```