
DuckDB SQL: F1 Dashboard
by marimo team
Explore F1 races with DuckDB as a backend in marimo.
About this notebook
This notebook builds a Formula 1 career dashboard with marimo SQL cells, DuckDB, and Altair. It downloads a zip archive of Formula 1 World Championship data hosted with the notebook, extracts the CSV files, and loads each file into a DuckDB table.
Two dropdowns drive the dashboard. Pick a driver (Lewis Hamilton by default) and, if you want, one constructor from that driver's career. marimo re-runs every SQL query that depends on the choice and refreshes stat cards for wins, podiums, races, points, pole positions, and fastest laps. The points-by-season bar chart is a selection widget: click a year, and the notebook charts podium finishes, DNF reasons, and qualifying versus race positions for that season. A second chart plots each race as a dot. Click one to open a race report with lap-time statistics, positions gained and lost, and pit-stop counts.
Each query is a marimo SQL cell that inserts the selected driver and constructor ids into its SQL text, so DuckDB filters the joined tables on every change. The race report query uses common table expressions over the lap-time and pit-stop tables. The notebook also runs in the browser on DuckDB-Wasm, where it installs sqlglot with micropip.











