Skip to content

asdf8601/druidq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DruidQ

Simple druid cli to query druid using sqlalchemy.

Installation

pipx install git+https://github.com/mmngreco/druidq

Note

I you are on MacOS I recommend creating a new venv and avoid using pipx

Usage

# String
druidq "select 1"

# send python code
druidq "select 1" -e "print(df)"

# silent mode
druidq "select 1" -e "print(df)" -q

# no cache
druidq "select 1" -e "print(df)" -f

# file
druidq ./query.sql
# customs URLs
DRUIDQ_URL='druid://localhost:8887/' druidq ./query.sql
DRUIDQ_URL='druid://localhost:8082/druid/v2/sql/' druidq ./query.sql

Examples

You can try the following:

mkdir /tmp/druidq/
cd /tmp/druidq/
echo "select 1" > query.sql
export DRUIDQ_URL='druid://localhost:8887/'

# read query from a file
druidq ./query.sql
druidq ./query.sql -e "print(df.shape)"

# use python scrits
echo "print(df.shape)" >> script.py
echo "print(df.T)" >> script.py
druidq ./query.sql -e ./script.py

You can also use the execute function only

from druidq import execute

execute("select 1")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published