48 releases (5 breaking)

new 0.6.7 Sep 18, 2023
0.6.3 Aug 29, 2023
0.5.0 Jul 28, 2023
0.1.3 Mar 30, 2023

#402 in Database interfaces

Download history 75/week @ 2023-05-29 65/week @ 2023-06-05 18/week @ 2023-06-12 42/week @ 2023-06-19 113/week @ 2023-06-26 135/week @ 2023-07-03 187/week @ 2023-07-10 119/week @ 2023-07-17 137/week @ 2023-07-24 49/week @ 2023-07-31 153/week @ 2023-08-07 93/week @ 2023-08-14 119/week @ 2023-08-21 181/week @ 2023-08-28 2661/week @ 2023-09-04 3049/week @ 2023-09-11

6,020 downloads per month
Used in 3 crates

Apache-2.0

135KB
3K SLoC

Databend Driver

Databend unified SQL client for RestAPI and FlightSQL

crates.io License

usage

exec

use databend_driver::Client;

let dsn = "databend://root:@localhost:8000/default?sslmode=disable".to_string();
let client = Client::new(dsn);
let conn = client.get_conn().await.unwrap();

let sql_create = "CREATE TABLE books (
    title VARCHAR,
    author VARCHAR,
    date Date
);";
conn.exec(sql_create).await.unwrap();
let sql_insert = "INSERT INTO books VALUES ('The Little Prince', 'Antoine de Saint-Exupéry', '1943-04-06');";
conn.exec(sql_insert).await.unwrap();

query row

let row = conn.query_row("SELECT * FROM books;").await.unwrap();
let (title,author,date): (String,String,i32) = row.unwrap().try_into().unwrap();
println!("{} {} {}", title, author, date);

query iter

let mut rows = conn.query_iter("SELECT * FROM books;").await.unwrap();
while let Some(row) = rows.next().await {
    let (title,author,date): (String,String,chrono::NaiveDate) = row.unwrap().try_into().unwrap();
    println!("{} {} {}", title, author, date);
}

Dependencies

~17–58MB
~1M SLoC