#arrow #driver #adbc #statement #default #linked

adbc_snowflake

Snowflake Arrow Database Connectivity (ADBC) driver

1 unstable release

0.18.0 May 6, 2025

#1662 in Database interfaces

Download history 91/week @ 2025-04-30 33/week @ 2025-05-07

124 downloads per month

Apache-2.0

310KB
5.5K SLoC

logo

crates.io docs.rs

Snowflake driver for Arrow Database Connectivity (ADBC)

A Snowflake ADBC driver, based on the ADBC Snowflake Go driver.

Example

use adbc_core::{Connection, Statement};
use adbc_snowflake::{connection, database, Driver};
use arrow_array::{cast::AsArray, types::Decimal128Type};

# fn main() -> Result<(), Box<dyn std::error::Error>> {

// Load the driver
let mut driver = Driver::try_load()?;

// Construct a database using environment variables
let mut database = database::Builder::from_env()?.build(&mut driver)?;

// Create a connection to the database
let mut connection = connection::Builder::from_env()?.build(&mut database)?;

// Construct a statement to execute a query
let mut statement = connection.new_statement()?;

// Execute a query
statement.set_sql_query("SELECT 21 + 21")?;
let mut reader = statement.execute()?;

// Check the result
let batch = reader.next().expect("a record batch")?;
assert_eq!(
    batch.column(0).as_primitive::<Decimal128Type>().value(0),
    42
);

# Ok(()) }

Crate features

Linking Go driver

This crate is a wrapper around the Go driver.

There are different methods to load the Go driver:

bundled (default)

Builds the driver from source and links it statically. This requires a Go compiler to be available at build time. This is the default behavior.

linked

Link the driver at build time. This requires the driver library to be available both at build- and runtime. Set ADBC_SNOWFLAKE_GO_LIB_DIR during the build to add search paths for the linker.

Runtime only

It's also possible to build this crate without the driver and only link at runtime. This requires disabling the bundled and linked features. Linking at runtime is also available when the other features are enabled.

Configuration

The crate provides builders that can be initialized from environment variables.

env (default)

Adds from_env methods to initialize builders from environment variables.

dotenv: env (default)

Loads environment variables from .env files in from_env methods.

Dependencies

~8–19MB
~186K SLoC