Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Connecting Ruby and Apache Doris with ADBC

Instructions

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.

Prerequisites

  1. Install Ruby

  2. Install dbc

  3. Ensure the native Arrow GLib and ADBC GLib libraries required by red-adbc are installed and discoverable. If bundle install reports missing arrow, arrow-glib, or adbc-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.

  4. Install Ruby dependencies:

    bundle install

    If you have multiple Ruby installations, ensure ruby and bundle resolve to the same installation before running this command.

Set up Apache Doris

Warning

This setup process has not been tested on Windows and might not work without modification. Windows users should run it under WSL.

  1. Install Docker

  2. Download the Apache Doris quick-start script:

    curl -O https://doris.apache.org/files/start-doris.sh
  3. Add Flight SQL ports and configure the backend to advertise localhost:

    sed -i.bak -f patch-doris.sed start-doris.sh
  4. Start an Apache Doris cluster:

    chmod 755 start-doris.sh
    ./start-doris.sh

Connect to Apache Doris

  1. Install the Flight SQL ADBC driver:

    dbc install --level user flightsql
  2. Customize the Ruby script main.rb as needed.

    • Change the connection arguments in database.set_option().
      • uri is the URI of your Apache Doris instance. The host and FE Arrow Flight SQL port will depend on your installation.
      • username and password are the username and password of your Apache Doris user.
    • Change the SQL SELECT statement in connection.query() if desired.
  3. Run the Ruby script:

    bundle exec ruby main.rb

Clean up

Stop the Docker project running Apache Doris:

docker compose -f docker-compose-doris.yaml down