Cheatography
https://cheatography.com
Druid & Rune cheat sheet. Draft only for now.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Port-forward to the Druid cluster
kubectl port-forward -n wiremind-druid-{env} druid-{env}-broker-{id-container} 8082:8082
|
Exemple: kubectl port-forward -n wiremind-druid-staging druid-staging-broker-795c756456-sjbm9 8082:8082
Optional: configure a SQL client
If you want to query Druid with an SQL client, you can do so using this driver.
In Database URL, specify: jdbc:avatica:remote:url=http://localhost:8082/druid/v2/sql/avatica/
|
Tools: DBVizualizer, DBeaver, DataGrip, ...
|
|
What data sources can I query?
fact_passenger_event
Granularity |
od_id X event_type X ticket_key |
Refresh |
daily |
Time reference (__time) |
Exact timestamp of the event. |
event_type can be: abandon_cart
, confirm_purchase
, cancel_purchase
fact_daily_od_bucket
Granularity |
od_id X bucket_id X day_x |
Refresh |
daily |
Time reference (__time) |
UTC time at train timezone midnight corresponding to this day_x |
fact_daily_leg_physical_inventory
Granularity |
leg_id X physical_inventory_id X day_x |
Refresh |
daily |
Time reference (__time) |
UTC time at train timezone midnight corresponding to this day_x |
|
|
Useful SQL functions
Cast datetime to date |
CAST(departure_datetime TO DATE) |
Most common columns
__time |
If possible, filter on. |
day_x |
Compute using the sevice timezone. |
[origin/destination]_station_[id/name/zone] |
[departure/arrival]_datetime |
service_[id/number/status] |
market_[id/name] |
ordered_leg_ids |
You must use ARRAY functions. |
od_[capacity/lid/id] |
bucket_name |
availability[_physical]_seats_[start/end]_day |
[cumulative_]sum_[cancelled/confirmed/net]_bookings |
[cumulative_]sum_[net]_revenue_vat_[inc/exc] |
has_event_occurred |
If the line is exactly the same as the day before. |
price_vat_[inc/exc] |
For fact_passenger_event, it might be 0 (abandon_cart) or negative (cancelled_purchase). Use base_price_vat_inc for initial price. |
travel_time_minute |
|