Building an Interactive Data Engineering Blog with DuckDB-WASM
Building an Interactive Data Engineering Blog with DuckDB-WASM
Welcome to my new interactive blog. This blog doesn't just show code—it runs it. Using the exact same architecture that powers my /analytics dashboard, we can execute highly performant OLAP queries entirely in the browser using DuckDB-WASM via HTTP range requests on remote Parquet files.
This is what I call "Evidence BI-as-Code".
The ATP Tennis Dataset
To demonstrate this, I am querying the live ATP Tennis dataset. I have set up an Apache Airflow DAG that fetches the data from a remote source, transforms it using dbt, and outputs highly compressed .parquet files.
Because DuckDB-WASM is running locally on your machine right now, you can execute the SQL below, and the engine will fetch only the specific byte ranges required from the .parquet files.
1. Top Players by Match Wins (2000-2024)
Let's run a query to find the most successful players over the last two decades. Notice how fast it executes in the browser without any backend server processing the query.
Most Wins (2000-2024)
SELECT
winner_name as Player,
COUNT(*) as Wins,
MAX(tourney_date) as Last_Win_Date
FROM atp_matches
WHERE tourney_date >= '2000-01-01'
GROUP BY winner_name
ORDER BY Wins DESC
LIMIT 10;
2. The Rise of the Aces
We can also perform complex aggregations. Here, we analyze the average number of aces hit by the winner across different surface types (Grass, Clay, Hard, Carpet).
Average Aces by Surface Type
SELECT
surface as Surface,
ROUND(AVG(w_ace), 2) as Avg_Aces,
COUNT(*) as Total_Matches
FROM atp_matches
WHERE w_ace IS NOT NULL AND surface IS NOT NULL
GROUP BY surface
ORDER BY Avg_Aces DESC;
Why This Architecture Matters (2026 Strategy)
The traditional modern data stack requires a cloud data warehouse (Snowflake/BigQuery) directly queried by an BI tool (Tableau/Looker). This involves high compute costs and network latency.
By moving the final aggregation layer directly into the client's browser with WebAssembly:
- Zero Compute Costs: Your users' laptops execute the SQL.
- Sub-second Latency: DuckDB operates on highly optimized memory vectors.
- Decentralized Data Applications: You can build entire data products served statically from edge networks (like Vercel).
Stay tuned for more interactive MotherDuck Dives, Kafka streaming walkthroughs, and Airflow orchestration strategies!