Skip to main content

Apache Druid querying client library

Project description

Apache Druid Query Library

A simple library for creating and executing queries with Apache Druid.

Usage

SQL Queries

from druid_query.client import Client
from druid_query.queries import Sql

client = Client(sql_endpoint='localhost:8082/druid/v2/sql/')

query = Sql('SELECT * FROM wikipedia LIMIT 10')

result = client.execute(query)

print(result)

Native Queries

from druid_query.client import Client
from druid_query.components import *
from druid_query.queries import Timeseries

client = Client(native_endpoint='localhost:8082/druid/v2/')

query = Timeseries('wikipedia', [intervals.Interval('2015-09-11', '2015-09-13')], granularities.Period('PT2H'), aggregations=[aggregations.Count('num_records')])

result = client.execute(client, query)

print(result)

Async support

from druid_query.client import AsyncClient
from druid_query.queries import Sql
import asyncio

client = AsyncClient(sql_endpoint='localhost:8082/druid/v2/sql/')

query = Sql('SELECT * FROM wikipedia LIMIT 10')

result = asyncio.run(client.execute(query))

print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

druid_query-0.3.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

druid_query-0.3.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file druid_query-0.3.1.tar.gz.

File metadata

  • Download URL: druid_query-0.3.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for druid_query-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0e1faeb40a998fe18d8fd2767c1860b091bcb3136c53e7df6699741576468780
MD5 1c09b99e7fa5e31f37a59b8abac50f8f
BLAKE2b-256 84de221f038a76f1b9415520bd1c0e62163ad28e9fd033f3aa16fd8ae13f366a

See more details on using hashes here.

File details

Details for the file druid_query-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: druid_query-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for druid_query-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e01685f62a7e1e08f4ee2021dfd78ee62f158f66fbb97823b0ed652bb1bbe323
MD5 333fc16025e621f94a8bf9b431d14d74
BLAKE2b-256 de3d6dacf2592381a6be0d48db11e15dafa791014fcfda4c5f7741e6aa06c76e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page