Tip
If you already have a Druid instance running, skip the steps to set up Druid.
-
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 -
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
-
Install the Druid ADBC driver:
dbc install --pre druid
-
Customize the Python script
main.pyas needed- Change the connection arguments in
db_kwargs- Format
uriaccording to the driver documentation, or keep it as is
- Format
- Change the connection arguments in
-
Run the Python script:
uv run main.py
Stop the Docker container running Druid:
docker stop druid