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 | |
import duckdb | |
from streamlit_searchbox import st_searchbox | |
atp_duck = duckdb.connect('atp.duck.db', read_only=True) | |
def search_players(search_term): | |
query = ''' | |
SELECT DISTINCT winner_name AS player | |
FROM matches |
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 duckdb | |
import pandas as pd | |
con = duckdb.connect('atp-matches.db') | |
con.sql("INSTALL httpfs") | |
con.sql("LOAD httpfs") | |
csv_files = [ | |
f"https://raw.githubusercontent.com/JeffSackmann/tennis_atp/master/atp_matches_{year}.csv" |
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
CREATE OR REPLACE TABLE players | |
AS SELECT * FROM read_csv_auto('atp_players.csv', SAMPLE_SIZE=-1); | |
CREATE OR REPLACE TABLE rankings AS | |
select * | |
from 'atp_rankings_*.csv'; | |
SELECT player_id, name_first, name_last | |
FROM players | |
LIMIT 5; |
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
-- Fails because of weird date | |
CREATE TABLE players AS | |
select * | |
from 'atp_players.csv'; | |
-- all varchar | |
CREATE TABLE players1 AS | |
select * | |
from read_csv_auto('atp_players.csv', ALL_VARCHAR=TRUE); |
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
SELECT count(*) | |
FROM 'data/*.parquet'; | |
SELECT * | |
FROM 'data/*.parquet' | |
LIMIT 10; | |
DESCRIBE | |
SELECT * | |
FROM 'data/yellow_tripdata_2011-07.parquet'; |
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
# The NYC Taxis Dataset - https://www1.nyc.gov/site/tlc/about/tlc-trip-record-data.page | |
pip install parquet-cli | |
parq data/yellow_tripdata_2022-01.parquet | |
parq data/yellow_tripdata_2022-01.parquet --schema | |
parq data/yellow_tripdata_2022-01.parquet --head 10 |
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
///usr/bin/env jbang "$0" "$@" ; exit $? | |
//DEPS org.apache.pinot:pinot-jdbc-client:0.8.0 | |
//DEPS com.github.freva:ascii-table:1.2.0 | |
// jbang Query.java "select * from customers limit 5" | |
// export JDBC_URL="jdbc:pinot://localhost:9000" | |
import static java.lang.System.*; | |
import java.sql.*; | |
import java.util.*; |
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
event: message | |
id: [{"topic":"eqiad.mediawiki.recentchange","partition":0,"timestamp":1635935095001},{"topic":"codfw.mediawiki.recentchange","partition":0,"offset":-1}] | |
data: {"$schema":"/mediawiki/recentchange/1.0.0","meta":{"uri":"https://pl.wikipedia.org/wiki/Kategoria:Infoboksy_%E2%80%93_brakuj%C4%85ce_parametry_%E2%80%93_Jednostka_administracyjna_infobox","request_id":"45eb5803-f73b-410c-a640-c76c5d86d91f","id":"5a7ee8b2-fead-4d54-b6fc-4bb433a08e51","dt":"2021-11-03T10:24:55Z","domain":"pl.wikipedia.org","stream":"mediawiki.recentchange","topic":"eqiad.mediawiki.recentchange","partition":0,"offset":3410637559},"id":119002871,"type":"categorize","namespace":14,"title":"Kategoria:Infoboksy – brakujące parametry – Jednostka administracyjna infobox","comment":"usunięto [[:Sukhaura]] z kategorii","timestamp":1635935095,"user":"MalarzBOT","bot":true,"server_url":"https://pl.wikipedia.org","server_name":"pl.wikipedia.org","server_script_path":"/w","wiki":"plwiki","parsedcomment":"usunięto <a href=\"/wiki/Sukh |
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 | |
import time | |
st.title("GitHub Events") | |
broker_port = 8000 | |
conn = connect(host='localhost', port=broker_port, path='/query/sql', scheme='http') |
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""" |