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.1.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file druid_query-0.2.1.tar.gz
.
File metadata
- Download URL: druid_query-0.2.1.tar.gz
- Upload date:
- Size: 9.1 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a54dd01caa850d7d0a68483dc5ef10efd530e239641a5f67a590d76743c7e89 |
|
MD5 | 5551d5db6747e192516ce493121d19c6 |
|
BLAKE2b-256 | 0cf9a117d6ad9019c6d3f985bc0d0c86d7bd54b0d8f95121287bcddf51bbd637 |
File details
Details for the file druid_query-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: druid_query-0.2.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2cc4bcad9b1d81ff0bee9f2172f6e3690bf2f5bd71eea832113d743b0a86c08 |
|
MD5 | 083f0f3b9937c302ccaf6f1f14add72c |
|
BLAKE2b-256 | a97ec4f461a15356135310ffe89f5c78c621dc4243872651e545188ae3fa6e01 |