This example uses Dremio, a data lakehouse platform that supports Arrow Flight SQL.
Tip
If you already have a Dremio instance running, skip the steps to set up Dremio.
- Sign up for Dremio Cloud or follow the instructions to set up Dremio Community.
-
Install the Flight SQL ADBC driver:
dbc install flightsql
-
Customize
src/main.rsas needed-
Change the connection arguments in
opts-
OptionDatabase::Uriis the URI of your Dremio instance. The host and port will depend on your installation (the default port is 32010). The protocol scheme should begrpcorgrpc+tcpif your Dremio instance is not using TLS (e.g. if you are using Dremio Community) and should begrpc+tlsotherwise (e.g. when using Dremio Cloud). -
OptionDatabase::UsernameandOptionDatabase::Passwordare the username and password of your Dremio account. (If you are using Dremio Community, these were set during the installation instructions.) -
For Dremio Cloud, don't use username and password; instead create a personal access token (PAT), store it in a string variable
tokeninmain(), and set the options to:let opts = [ ( OptionDatabase::Uri, "grpc+tls://data.dremio.cloud:443".into(), // for US region //"grpc+tls://data.eu.dremio.cloud:443".into(), // for Europe region ), ( OptionDatabase::Other("adbc.flight.sql.authorization_header".to_string()), format!("Bearer {}", token).into(), ), ];
-
-
If you changed
OptionDatabase::Urito point to a different Flight SQL server, also change the SQL SELECT statement instatement.set_sql_query()
-
-
Run the Rust program:
cargo run