Show Menu
Cheatography

Run extend Cheat Sheet (DRAFT) by

Voici une description ! :)

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Rune tips

 

Bootstrap on Rune

from rune.query import Rune
from rune.registry import serpe_factory
from rune.helpers import druid_host_to_connection


SerpeFactory = serpe_factory()


sr = SerpeFactory(druid_host_to_connection('http://localhost:8082'), 'ouigo')


rune = Rune(sr)
The rune object has execut­­e_­n­a­ti­­ve_­­to_df and execut­­e_­s­q­l_­­to_df methods.

Native queries

execut­e_n­ative
or
execut­e_n­ati­ve_­to_df
have the same interf­aces.

First argument: the table you want to query; taken from serpe object (ie:
sr.ser­pe.f­ac­t_p­ass­eng­er_­event
).

Optional arguments:

intervals: List[str], pre-filter on
__time
column. Must be specified most of the time, allows great optimi­zation.

columns: List[U­nio­n[str, SerpeE­nti­ty]], columns you want to select. You can put either strings or objects from serpe.

where: conditions on objects taken from serpe. Ex:
sr.ser­pe.d­ep­art­ure­_da­tetime >= '2019-­01-01


Check rune docume­ntation for other args: timeout, limit, priority, querytype, use_cache, ...
Example:
rune.e­­xe­­cu­t­e­_n­­ati­­ve­_­t­o_­­df(­­sr.s­­er­­pe.f­­a­c­t­_p­­ass­­en­g­e­r_­­event, column­­s=­[­'­de­­par­­tu­r­e­_d­­ate­­ti­me'], where=­­sr.s­­er­­pe.s­­e­r­v­ic­­e_n­­umber == 7699, limit=10, interv­­al­s­=­['­­201­­8-­0­1­-0­­1/2­­01­8­-­01­­-02'])

How to use CLI?

rune ouigo --druid-host http://localhost:8082
rune --help if you want more inform­ation