🏝️ About
Ever wanted to get your favorite beach's water quality like this :
With this article you'll learn how I could:
- Get (scrap) the data
- Load data into a database
-
Backup & export (
csv
&Apache parquet
) - Commit data to GitHub
-
Query from any terminal from
duckdb
🧫 About water quality
🍿 Demo
🔖 Source code
adriens / odata-eaux-baignade-noumea
Experience Open Data de la qualité des eaux de baignade à Nouméa
❔ About
See https://www.kaggle.com/code/adriensales/la-qualit-des-eaux-de-baignade-noum-a
⚡ For impatients
Just run the following script in any shell and enjoy:
#!/bin/sh
# Diplay latest flags
sh <(curl https://tea.xyz) +duckdb.org \
duckdb << EOF
INSTALL httpfs;
LOAD httpfs;
select plage,
flag_color,
case
when (flag_color = 'BLUE') THEN '🟦'
when (flag_color = 'YELLOW') THEN '🟨'
when (flag_color = 'RED') THEN '🟥'
end as flag_color
from read_csv_auto('https://bit.ly/3ZCJ1X5') as latest;
EOF
🦆 DuckDb
hacks
First, install duckdb (brew install duckdb
) or install_duckdb.sh
INSTALL httpfs;
LOAD httpfs;
.prompt "🦆 🏖️ > "
select *
from 'https://raw.githubusercontent.com/adriens/odata-eaux-baignade-noumea/main/data/latest.csv';
INSTALL httpfs;
LOAD httpfs;
.prompt "🦆 🏖️ > "
select *
from 'https://raw.githubusercontent.com/adriens/odata-eaux-baignade-noumea/main/data/historic.csv';
You can also use (nicer) short urls :
duckdb << EOF
-- historic
INSTALL httpfs;
LOAD httpfs;
select *
from
read_csv_auto('https://bit.ly/3mAUIPr') as historic;
EOF
duckdb << EOF
-- historic
INSTALL httpfs;
LOAD httpfs;
select *
from
…
Top comments (5)
Adrien Sales on LinkedIn: ✂️ Tea <3 DuckDb
⏱️ Challenge accepted : within less than 14 seconds on any fresh & rootless session on Killercoda🏎️ 1️⃣ Install tea.xyz 2️⃣ Install DuckDB Labs 3️⃣ Get a…