Skip to content

Druid

Installation

pip install "toolfront[druid]"

Connection URL

Connect to Druid by passing a connection URL to the Database constructor:

1
2
3
4
5
from toolfront import Database

db = Database(url="druid://{host}:{port}/{path}")

revenue = db.ask("What's our total revenue this month?")

Connection Parameters

Alternatively, connect using the Database.from_druid() method with parameters:

1
2
3
4
5
6
7
8
9
from toolfront import Database

db = Database.from_druid(
    host="localhost",
    port=8082,
    path="druid/v2/sql"
)

revenue = db.ask("What's our total revenue this month?")
PARAMETER DESCRIPTION
host

Hostname or IP address of the Druid broker node.

TYPE: str

port

Port number for the Druid broker node.

TYPE: int

path

Path to the Druid endpoint (if needed).

TYPE: str DEFAULT: None

match_schema

Regex pattern to filter schemas. Mutually exclusive with match_tables.

TYPE: str DEFAULT: None

match_tables

Regex pattern to filter tables. Mutually exclusive with match_schema.

TYPE: str DEFAULT: None

**kwargs

Additional arguments passed to the DBAPI connection call.

TYPE: Any DEFAULT: {}