How to pass query context for eanbling window functions using druidapi in python code
- Dominant language
- Java
- Stars
- 14.1k
- Forks
- 3.8k
- Avg merge
- 2d 58m
- Merged PRs (30d)
- 233
Description
example code:
import druidapi
import os
if 'DRUID_HOST' not in os.environ.keys():
druid_host=f"http://localhost:8888"
else:
druid_host=f"http://{os.environ['DRUID_HOST']}:8888"
print(f"Opening a connection to {druid_host}.")
druid = druidapi.jupyter_client(druid_host)
display = druid.display
sql_client = druid.sql
query = """WITH HumidChange AS (SELECT device_id,__time,humidity,humidity - LAG(humidity) OVER (PARTITION BY device_id ORDER BY __time) AS humid_change FROM thermal_log) SELECT d.device_id,d.device_name,tc.__time,tc.humidity AS current_humidity, tc.humid_change FROM devices d JOIN HumidChange tc ON d.device_id = tc.device_id WHERE tc.humid_change >= 10"""
display.sql(query)
Contributor guide
Research direction
Start with the provided Python example and the druidapi.jupyter_client, display, and display.sql entry points. Determine where query context is accepted for this call and document a working example that enables the requested window-function behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100