Last active
July 20, 2021 19:55
-
-
Save mneedham/27346d59b22cdaf532a152c65ca22072 to your computer and use it in GitHub Desktop.
Pinot queries rendered in Streamlit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from pinotdb import connect | |
import pandas as pd | |
st.title("GitHub Events") | |
broker_port = 8000 | |
conn = connect(host='localhost', port=broker_port, path='/query/sql', scheme='http') | |
query = f""" | |
select organization, repo, sum(numLinesAdded) | |
from pullRequestMergedEvents | |
where createdTimeMillis > cast((now() - %(subtract_time)d*1000*60) as long) | |
group by organization, repo | |
order by sum(numLinesAdded) DESC | |
limit 10 | |
""" | |
subtract_time = 24*60 | |
curs = conn.cursor() | |
curs.execute(query, {"subtract_time": subtract_time}) | |
st.header("Most active repositories") | |
st.table(pd.DataFrame(curs, columns=[item[0] for item in curs.description])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment