Friday, January 04, 2019

Jupyter SQL


Jupyther notebooks are an excellent tool for exploring and presenting data processing.
Not limited to python only could be used even with SQL!

ipython-sql · PyPI

screenshot of ipython-sql in the Notebook


Jupyter Magics with SQL – Towards Data Science

In [1]:
import pandas as pd
from sqlalchemy.engine import create_engine

# Presto
engine = create_engine('presto://localhost:8080/system/runtime') 

#Read Presto Data query into a DataFrame
df = pd.read_sql('select * from queries limit 1', engine)
df.head()
Out[1]:

node_idquery_idstateusersourcequeryqueued_time_msanalysis_time_msdistributed_planning_time_mscreatedstartedlast_heartbeatend
0ffffffff-ffff-ffff-ffff-ffffffffffff20180526_115416_00010_nwiisRUNNINGsatybaldpyhiveselect * from queries limit 1117

No comments: