Description
What feature or improvement would you like to see?
I'm interested in the Rust implementation of ADBC, and I tried the driver manager.
Since there wasn't a quickstart, it was a bit difficult for me. (I'm new to Rust.)
There is detailed information in Doc.rs, but I think it's difficult for a beginner to get it running right away.
It might be helpful to have a quickstart like this for Rust as well.
Alternatively, it might be better to start by adding it to the README rather than the website.
Currently, there is no README under rust/core/
.
I assume the Rust-related implementation is still in its early stages and will be further developed soon, so it may not be necessary to document its current usage in detail yet.
Additionally, I understand that it wouldn't make sense to maintain duplicate content with Doc.rs.
But I just thought it might be helpful to have a simple quickstart somewhere for now.
If it would be helpful, I'm happy to add it.
I’m considering a quickstart like the following:
$ cargo add adbc_core --features driver_manager
$ cargo add arrow
$ cargo add arrow-cast --features prettyprint
use adbc_core::driver_manager::ManagedDriver;
use adbc_core::options::{AdbcVersion, OptionDatabase};
use adbc_core::{Connection, Database, Driver, Statement};
use arrow::array::RecordBatch;
use arrow_cast::pretty::print_batches;
fn main() {
let opts = [(OptionDatabase::Uri, ":memory:".into())];
let mut driver = ManagedDriver::load_dynamic_from_filename(
"/PATH/TO/libadbc_driver_sqlite.so",
None,
AdbcVersion::default(),
).unwrap();
let mut database = driver.new_database_with_opts(opts).unwrap();
let mut connection = database.new_connection().unwrap();
let mut statement = connection.new_statement().unwrap();
statement.set_sql_query("SELECT 1, 2.0, 'Hello, world!'").unwrap();
let reader = statement.execute().unwrap();
let batches: Vec<RecordBatch> = reader.map(|b| b.unwrap()).collect();
print_batches(&batches).unwrap();
}
$ cargo run
+---+-----+-----------------+
| 1 | 2.0 | 'Hello, world!' |
+---+-----+-----------------+
| 1 | 2.0 | Hello, world! |
+---+-----+-----------------+