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.
-
Install Node.js (version 22 or later)
-
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
-
Install dependencies:
npm --prefix ../.. install
-
Customize the script
main.jsas needed:- Change the connection arguments in
databaseOptionsuriis 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
conn.query()
- Change the connection arguments in
-
Run the script:
Node.js:
node main.js
Bun:
bun run main.js
Deno:
deno run --allow-ffi --allow-env main.js
Stop the Docker container running InfluxDB:
docker stop influxdb