Skip to content

Latest commit

 

History

History

druid

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Connecting Python and Apache Druid with ADBC

Instructions

Tip

If you already have a Druid instance running, skip the steps to set up Druid.

Prerequisites

  1. Install uv

  2. Install dbc

Set up Druid

  1. Install Docker

  2. Start a Druid 37 nano-quickstart instance:

    docker run --detach --rm \
      --name druid \
      --platform linux/amd64 \
      --publish 8888:8888 \
      --volume "$PWD/start-druid.sh:/opt/druid/start-druid.sh:ro" \
      --entrypoint /bin/bash \
      apache/druid:37.0.0 /opt/druid/start-druid.sh
  3. Wait for Druid to accept SQL queries:

    until curl --fail --silent --output /dev/null \
      --header 'Content-Type: application/json' \
      --data '{"query":"SELECT 1"}' \
      http://localhost:8888/druid/v2/sql; do sleep 2; done

Connect to Druid

  1. Install the Druid ADBC driver:

    dbc install --pre druid
  2. Customize the Python script main.py as needed

    • Change the connection arguments in db_kwargs
  3. Run the Python script:

    uv run main.py

Clean up

Stop the Docker container running Druid:

docker stop druid