A year of trips, four files, no import step
A year of bike-share trips split across four Parquet files, queried where they lie by an engine running inside the process. No server, no import step, and a window function that sorts the network into commuters and afternoon wanderers.
A year of trips, four files, no import step
DuckDB is an analytical database that runs inside your process. There is no server to start and, for this notebook, no database file either: the data stays in four Parquet files on disk and DuckDB reads them where they lie.
That is the part worth seeing. A year of bike-share trips arrived the way exports usually arrive, split one file per quarter, and the usual next step is to load them into something before you can ask a question. Here the loading step does not exist. The first query reads all four files and the last one hands its result to Python for a chart.
1#r "nuget: DuckDB.NET.Data.Full, 1.5.5"
- DuckDB.NET.Data.Full, 1.5.5
Transitive dependencies (3)
- Apache.Arrow, 23.0.0
- Apache.Arrow.Scalars, 23.0.0
- DuckDB.NET.Bindings.Full, 1.5.5
Verso connects to any ADO.NET provider, so DuckDB is reached the same way SQL
Server or PostgreSQL would be. Data Source=:memory: means there is no database
file at all: the engine exists only for the length of this run, and everything
it reads comes from the Parquet files.
1#!sql-connect --name trips --connection-string "Data Source=:memory:" --provider DuckDB.NET.Data --default
Connected 'trips' (default) using DuckDB.NET.Data — database: :memory: Connection string: Data Source=:memory:
What is in the files
read_parquet takes a glob. DESCRIBE in front of a query returns the columns
and their types, read out of the Parquet footers rather than declared anywhere,
which is the whole reason this works without an import.
1DESCRIBE SELECT * FROM read_parquet('trips-2026-q*.parquet')
| column_name | column_type | null | key | default | extra |
|---|---|---|---|---|---|
| trip_id | BIGINT | YES | NULL | NULL | NULL |
| started_at | TIMESTAMP | YES | NULL | NULL | NULL |
| station | VARCHAR | YES | NULL | NULL | NULL |
| minutes | INTEGER | YES | NULL | NULL | NULL |
| member | BOOLEAN | YES | NULL | NULL | NULL |
Four files, thirty-two thousand trips, a full year. Counting them all is one statement and it never materializes a table.
1SELECT count(*) AS trips,2 count(DISTINCT station) AS stations,3 min(started_at)::DATE AS first_day,4 max(started_at)::DATE AS last_day,5 round(avg(minutes), 1) AS avg_minutes6FROM read_parquet('trips-2026-q*.parquet')
| trips | stations | first_day | last_day | avg_minutes |
|---|---|---|---|---|
| 31997 | 8 | 1/1/2026 | 12/31/2026 | 17.9 |
When each station is busy
Now a real question: for each station, which hour of the day is its busiest.
That is a ranking within a group, which means a window function, and DuckDB has
QUALIFY for filtering on one without nesting the query yourself.
The answer sorts the network into three groups, and nobody had to label a single station for it to do so.
1SELECT station,2 hour_of_day,3 trips4FROM (5 SELECT station,6 extract(hour FROM started_at) AS hour_of_day,7 count(*) AS trips8 FROM read_parquet('trips-2026-q*.parquet')9 GROUP BY ALL10)11QUALIFY rank() OVER (PARTITION BY station ORDER BY trips DESC) = 112ORDER BY hour_of_day, station
| station | hour_of_day | trips |
|---|---|---|
| Business Park | 8 | 467 |
| Central Station | 8 | 513 |
| Harbour Steps | 14 | 327 |
| Lakeside Path | 15 | 327 |
| Riverside North | 15 | 345 |
| Market Square | 16 | 340 |
| Old Mill | 17 | 317 |
| University Gate | 17 | 427 |
Central Station and Business Park peak at eight in the morning, on the way in. Market Square, Old Mill and University Gate peak between four and five, on the way home. Harbour Steps, Lakeside Path and Riverside North peak in the middle of the afternoon, which is nobody's commute: those are the three by the water.
Handing the result to another language
A query with --name publishes its result into the notebook's variable store as
a DataTable. C# picks it up by name, pulls out three plain lists, and Python
draws from those as though it had built them itself.
1--name profiles2SELECT extract(hour FROM started_at) AS hour_of_day,3 count(*) FILTER (WHERE station = 'Central Station') AS commuter,4 count(*) FILTER (WHERE station = 'Lakeside Path') AS leisure5FROM read_parquet('trips-2026-q*.parquet')6GROUP BY ALL7ORDER BY hour_of_day
| hour_of_day | commuter | leisure |
|---|---|---|
| 0 | 6 | 10 |
| 1 | 12 | 5 |
| 2 | 7 | 7 |
| 3 | 17 | 7 |
| 4 | 10 | 5 |
| 5 | 79 | 47 |
| 6 | 192 | 63 |
| 7 | 349 | 90 |
| 8 | 513 | 120 |
| 9 | 387 | 168 |
| 10 | 241 | 219 |
| 11 | 195 | 214 |
| 12 | 153 | 259 |
| 13 | 189 | 316 |
| 14 | 263 | 304 |
| 15 | 348 | 327 |
| 16 | 493 | 293 |
| 17 | 492 | 261 |
| 18 | 432 | 203 |
| 19 | 311 | 153 |
| 20 | 180 | 120 |
| 21 | 86 | 80 |
| 22 | 49 | 65 |
| 23 | 45 | 53 |
1using System.Data;23var table = Variables.Get<DataTable>("profiles")!;45var hours = new List<double>();6var commuter = new List<double>();7var leisure = new List<double>();89foreach (DataRow row in table.Rows)10{11 hours.Add(Convert.ToDouble(row["hour_of_day"]));12 commuter.Add(Convert.ToDouble(row["commuter"]));13 leisure.Add(Convert.ToDouble(row["leisure"]));14}1516$"{hours.Count} hours, {commuter.Sum():N0} commuter trips, {leisure.Sum():N0} leisure trips"
24 hours, 5,049 commuter trips, 3,389 leisure trips
1import matplotlib.pyplot as plt23# hours, commuter and leisure were left behind by the C# cell above4x = [int(h) for h in hours]56fig, ax = plt.subplots(figsize=(9.2, 4.0))7ax.plot(x, [float(v) for v in commuter], marker="o", ms=4, lw=2, label="Central Station")8ax.plot(x, [float(v) for v in leisure], marker="o", ms=4, lw=2, label="Lakeside Path")910ax.set_title("Trips by hour of day, a commuter station and a waterside one")11ax.set_xlabel("Hour")12ax.set_ylabel("Trips in 2026")13ax.set_xticks(range(0, 24, 2))14ax.legend(frameon=False)15ax.spines[["top", "right"]].set_visible(False)16ax.grid(axis="y", alpha=0.25)1718plt.tight_layout()19plt.show()
Two shapes, one dataset. The commuter station has the double hump everyone recognizes: a sharp spike at eight and a broader one across four and five. The waterside station has a single afternoon hill and barely notices rush hour.
Take it home
Download this notebook and the four trips-2026-q*.parquet files from the
gallery page, put them in the same folder, then open it in VS Code with the
Verso extension or serve it with verso serve duckdb-parquet.verso. Delete
three of the four files and rerun: the glob picks up whatever is there, and every
query still works on what is left.
Run it yourself
Nothing on this page is executable; the outputs were baked in by a real run. Download the notebook and it runs anywhere Verso does: VS Code, the browser, or the terminal.
dotnet tool install --global Verso.Cliverso serve duckdb-parquet.versoThis notebook reads trips-2026-q1.parquet, trips-2026-q2.parquet, trips-2026-q3.parquet, trips-2026-q4.parquet; download it into the same folder as the notebook.
What this shows
A year of bike-share trips split across four Parquet files, queried where they lie by an engine running inside the process. No server, no import step, and a window function that sorts the network into commuters and afternoon wanderers.
Every language in this notebook reads and writes the same variable store, so a value produced in one cell is simply there in the next, whatever the language.