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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: druid_query-0.3.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for druid_query-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e7dbda56e1c560027bd14a84b53afce86e0a58132b2acb1bfe352cc97b06a56d
MD5 bce2a4cc17ae05b023d5457ee69515a3
BLAKE2b-256 950c10d8fd70cef2583726de700eb894a76b63bc9a0ac465246b67311f25d8b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: druid_query-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for druid_query-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 154533bb4934138fa9b5c45d4ccf35ecba56c24e6ce2a6b7716dc562d3c616bb
MD5 06196938829f174edf0c2074cdc6b257
BLAKE2b-256 d2f56db4c0f6a80b9c26eefa9739fba6e650240a21e8408630cb6b47d363f299

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