This example uses InfluxDB, a time series database that supports Arrow Flight SQL.
Tip
If you already have an InfluxDB instance running, skip the steps to set up and clean up InfluxDB.
-
Start an InfluxDB instance:
docker run -d --rm --name influxdb -p 8181:8181 influxdb:3-core influxdb3
-
Create an authorization token:
docker exec -it influxdb influxdb3 create token --admin
-
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 InfluxDB instance. The host and port will depend on your installation.adbc.flight.sql.authorization_headeris the authorization header used for requests. ReplaceYOUR_AUTH_TOKENwith your InfluxDB authorization token.adbc.flight.sql.rpc.call_header.databaseis the name of your InfluxDB database.
- If you changed which database you're connecting to, also change the SQL SELECT statement in
statement.set_sql_query().
- Change the connection arguments in
-
Run the Rust program:
cargo run
Stop the Docker container running InfluxDB:
docker stop influxdb