This example uses Apache Doris, a high-performance, real-time analytical database.
Tip
If you already have an Apache Doris instance running, skip the steps to set up Apache Doris.
-
Ensure the native Arrow GLib and ADBC GLib libraries required by
red-adbcare installed and discoverable. Ifbundle installreports missingarrow,arrow-glib, oradbc-glib, use the platform-specific commands below.macOS with Homebrew
brew install apache-arrow-glib apache-arrow-adbc-glib
Debian/Ubuntu
sudo apt install libarrow-glib-dev libadbc-glib-dev
RHEL-compatible distributions
sudo dnf install arrow-glib-devel adbc-glib-devel
Windows with RubyInstaller/MSYS2 UCRT64
pacman -S --needed mingw-w64-ucrt-x86_64-arrow mingw-w64-ucrt-x86_64-arrow-adbc-glib
If you use a different MSYS2 environment, adjust the package prefix to match it; for example, use
mingw-w64-x86_64-*from the MINGW64 shell. -
Install Ruby dependencies:
bundle install
If you have multiple Ruby installations, ensure
rubyandbundleresolve to the same installation before running this command.
Warning
This setup process has not been tested on Windows and might not work without modification. Windows users should run it under WSL.
-
Download the Apache Doris quick-start script:
curl -O https://doris.apache.org/files/start-doris.sh
-
Add Flight SQL ports and configure the backend to advertise
localhost:sed -i.bak -f patch-doris.sed start-doris.sh
-
Start an Apache Doris cluster:
chmod 755 start-doris.sh ./start-doris.sh
-
Install the Flight SQL ADBC driver:
dbc install --level user flightsql
-
Customize the Ruby script
main.rbas needed.- Change the connection arguments in
database.set_option().uriis the URI of your Apache Doris instance. The host and FE Arrow Flight SQL port will depend on your installation.usernameandpasswordare the username and password of your Apache Doris user.
- Change the SQL
SELECTstatement inconnection.query()if desired.
- Change the connection arguments in
-
Run the Ruby script:
bundle exec ruby main.rb
Stop the Docker project running Apache Doris:
docker compose -f docker-compose-doris.yaml down