Skip to content

if0ne/adbc-clickhouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADBC Driver for Clickhouse

Example usage

use adbc_core::{
    Connection, Database, Driver,
    options::{OptionDatabase, OptionValue},
};

use adbc_clickhouse::driver::ClickhouseDriver;

fn main() {
    let mut driver = ClickhouseDriver::default();
    let database = driver
        .new_database_with_opts([
            (
                OptionDatabase::Uri,
                OptionValue::String("localhost:9000".to_string()),
            ),
            (
                OptionDatabase::Username,
                OptionValue::String("username".to_string()),
            ),
            (
                OptionDatabase::Password,
                OptionValue::String("password".to_string()),
            ),
            (
                OptionDatabase::Other("clickhouse.schema".to_string()),
                OptionValue::String("default".to_string()),
            )
        ])
        .unwrap();

    let connection = database.new_connection().unwrap();
    let batch = connection
        .get_objects(
            adbc_core::options::ObjectDepth::All,
            None,
            None,
            None,
            None,
            None,
        )
        .unwrap()
        .collect::<Vec<_>>()
        .into_iter()
        .filter_map(|s| s.ok())
        .collect::<Vec<_>>();

    arrow::util::pretty::print_batches(&batch).unwrap();
}

About

ADBC Driver for Clickhouse

Topics

Resources

Stars

Watchers

Forks

Languages