Skip to content

Latest commit

 

History

History

chdb

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Connecting Ruby and chDB with ADBC

Instructions

Note

The chDB ADBC driver supports Linux and macOS. Windows is not currently supported.

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 ruby apache-arrow-glib apache-arrow-adbc-glib
    export PATH="$(brew --prefix ruby)/bin:$PATH"
    Debian/Ubuntu
    sudo apt install -y ca-certificates lsb-release wget
    wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr "A-Z" "a-z")/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
    sudo apt install -y ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
    sudo apt update
    sudo apt install libarrow-glib-dev libadbc-glib-dev
    RHEL-compatible distributions
    sudo dnf install arrow-glib-devel adbc-glib-devel
  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. On macOS, prefer Homebrew Ruby or another current Ruby distribution over the system Ruby.

Connect to chDB

  1. Install the chDB ADBC driver:

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

    • Change the SQL SELECT statement in connection.query(), or keep it set to SELECT * FROM 'games.parquet'; to query the Parquet file included with this example
  3. Run the Ruby script:

    bundle exec ruby main.rb