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.2.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: druid_query-0.2.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for druid_query-0.2.0.tar.gz
Algorithm Hash digest
SHA256 69eb8118dd90a83940190fed3ec8189fbe9608abc089ebf0c6f79665138acea8
MD5 421586662884aef494d94bef93fd01a5
BLAKE2b-256 11fe5ada742a1234c0e9fa6fe4927ee6169fe416ba6cab93fcbbb061a28b40c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: druid_query-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for druid_query-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe9ab28230ce0f92a76096d1b71642069731b25acfcbab7453a0f4205b3938ab
MD5 3215eb98345596b2396324a664f84841
BLAKE2b-256 5b6897f0ac3739403d98f9748fa29fcee51071cb7098b5febdfe9699151ab1af

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