This example uses StarRocks, an open query engine for sub-second, ad-hoc analytics both on and off the data lakehouse.
Tip
If you already have a StarRocks instance running, skip the steps to set up StarRocks.
-
Install Node.js (version 22 or later)
-
Start a StarRocks instance:
docker run --rm -p 9030:9030 -p 8030:8030 -p 8040:8040 -p 9408:9408 -p 9419:9419 -itd \ --name quickstart starrocks/allin1-ubuntu
-
Configure StarRocks for Arrow Flight SQL:
docker exec quickstart sed -i 's/JAVA_OPTS="-Dlog4j2/JAVA_OPTS="--add-opens=java.base\/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED -Dlog4j2/' /data/deploy/starrocks/fe/conf/fe.conf docker exec quickstart bash -c 'echo "arrow_flight_port = 9408" >> /data/deploy/starrocks/fe/conf/fe.conf' docker exec quickstart bash -c 'echo "arrow_flight_port = 9419" >> /data/deploy/starrocks/be/conf/be.conf' docker restart quickstart
-
Wait for the container to become healthy before proceeding:
docker ps --filter "name=quickstart"
-
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 StarRocks instance. The host and FE Arrow Flight port will depend on your installation.usernameandpasswordare the username and password of your StarRocks user.
- Change the SQL SELECT statement in
conn.query()if desired.
- 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 StarRocks:
docker stop quickstart