Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Connecting C++ and Sail with ADBC

Instructions

This example uses Sail, a fast query engine that supports Arrow Flight SQL.

Tip

If you already have a Sail Flight SQL server running, skip the steps to set up Sail.

Prerequisites

  1. Install Pixi

  2. Install uv

  3. Install dbc

Set up Sail

  1. Install Sail:

    uv tool install pysail
  2. Start the Sail Flight SQL server:

    sail flight server --ip 127.0.0.1 --port 32010

Connect to Sail

  1. Install the Flight SQL ADBC driver:

    dbc install --level user flightsql
  2. Customize the C++ program main.cpp as needed

    • Change the connection arguments in the AdbcDatabaseSetOption() calls
      • uri is the URI of your Sail Flight SQL server. The host and port will depend on your installation (the default port is 32010). The protocol scheme should be grpc for plain connections or grpc+tls if your server is configured with TLS.
    • Change the SQL SELECT statement in AdbcStatementSetSqlQuery() if desired
  3. Build and run the C++ program:

    Using Make:

    pixi run make
    ./sail_demo

    Or using CMake:

    pixi run cmake -B build
    pixi run cmake --build build
    ./build/sail_demo

Clean up

  1. Clean build artifacts:

    Using Make:

    pixi run make clean

    Using CMake:

    rm -rf build
  2. Stop the Sail Flight SQL server by pressing Ctrl-C in the terminal where it is running.