DuckDB: lesson test 2026-10-11 (passed)
Record test:thklu3q. Question: Create a small CSV, aggregate it with SQL and get the result as JSON and CSV.
Answer
On 2026-10-11, the headlesson operator ran all 6 steps of this lesson with DuckDB 1.5.6 (macOS26.5.2 arm64; Homebrew duckdb 1.5.6 bottle installed during this test; self-made CSV input only), and all passed. The final Next step is advice and was not run. An independent check (revision 3fadc9d) covered: An independent re-run reproduced 0 of 6 steps from the start (the install step was not re-run); the outputs of the later 5 steps were checked separately, and values matched across JSON, CSV and Parquet. Its limits: Not an independent pass of the whole lesson. The JSON sum is a string and the Parquet type is DOUBLE. This is the operator's own run, not a vendor claim.
Tested on
- Test date: 2026-10-11
- Record confirmed: 2026-10-11
- Version: 1.5.6
- Environment: macOS26.5.2 arm64; Homebrew duckdb 1.5.6 bottle installed during this test; self-made CSV input only
- Result: passed, 6/6 steps
Lesson steps and what happened
- 1. [passed] brew install duckdb
- 2. [passed] duckdb --version
- 3. [passed] printf 'region,product,amount\nnorth,apple,3\nnorth,pear,5\nsouth,apple,7\nsouth,apple,1\neast,pear,4\n' > sales.csv
- 4. [passed] duckdb -init /dev/null -json -c "SELECT region, count(*) AS n, sum(amount) AS total FROM 'sales.csv' GROUP BY region ORDER BY total DESC"
- 5. [passed] duckdb -init /dev/null -csv -c "SELECT product, avg(amount) AS avg_amount FROM read_csv('sales.csv') GROUP BY product ORDER BY product"
- 6. [passed] duckdb -init /dev/null -c "COPY (SELECT region, sum(amount) AS total FROM 'sales.csv' GROUP BY region) TO 'totals.parquet' (FORMAT parquet)"
Next (advice, not tested)
Next: Agree with the user on the real data files and whether any output file may be written; run DESCRIBE SELECT * FROM '<file>' first to check the inferred column types, then run the aggregate with -json and compare row counts with the source.
Cautions recorded with the lesson
These notes come from the lesson. Some describe failures seen in tests; others are general cautions. Each one is not a separately tested result.
- sum() over an integer column returns HUGEINT, which -json prints as a quoted string (for example "total":"8"); CAST to BIGINT or DOUBLE when a JSON number is needed.
- The CLI runs ~/.duckdbrc on startup; pass -init /dev/null for a reproducible run.
- Column types are inferred from the CSV contents; check them with DESCRIBE before relying on numeric or date columns.
- Without a database file the CLI uses a temporary in-memory database; tables created there are lost when the command exits.
- Rows with equal ORDER BY values come back in no guaranteed order; add a tie-breaker column for stable output.
- Confirm: Check which files a query reads and writes (COPY ... TO overwrites paths) and confirm row counts and types before passing results to a downstream step.
What this record does not show
- Not measured in this run: remote files (httpfs/S3).
- Not measured in this run: extension installation over the network.
- Not measured in this run: large files.
- Not measured in this run: the web UI.
- Not measured in this run: safe mode.
- Not measured in this run: real user data.
- Whether an agent new to this tool can use it from this record alone (the operator wrote and ran the lesson).
- Comparisons between models or clients.
- Production use, accounts, or real customer data.
- Behaviour of the latest version (the test is tied to the version and date below).
- The final "Next" step is advice and was not part of the test.
Primary record
Operator record: a past lesson trial (legacy). It is not claimed to meet level L1 of run-task-contract/0.1.0.
Independent check
Independent check (revision 3fadc9d6215b): An independent re-run reproduced 0 of 6 steps from the start (the install step was not re-run); the outputs of the later 5 steps were checked separately, and values matched across JSON, CSV and Parquet.
Limits: Not an independent pass of the whole lesson. The JSON sum is a string and the Parquet type is DOUBLE.
Evidence
A non-public test report exists and is not published, so third parties cannot check it directly.
Retrieve over MCP
headlesson_get id="app:duckdb" sections ["lesson","gotchas"] on https://mcp.headlesson.com/mcp
Source version
This page is built from the catalog record app:duckdb at revision 9bafd789f564. It is not rewritten when the current lesson changes; a new test gets a new record ID.
Sources (lesson text at the fixed revision)
Each line names fields of this page (as JSON pointers into the .json version) and where they come from. Labels without a link are non-public sources. Fields not listed (such as test results) are the headlesson operator's own observations.
- /question, /next_advice, /cautions/items/2, /cautions/items/4, /cautions/items/5: headlesson editorial judgement (checked 2026-10-11, inferred, editorial)
- /steps/0/step: https://duckdb.org/install/ (checked 2026-10-11, primary, official)
- /steps/1/step, /steps/2/step, /steps/3/step, /steps/4/step, /steps/5/step, /cautions/items/0: headlesson editorial judgement (checked 2026-10-11, primary, editorial)
- /cautions/items/1, /cautions/items/3: https://duckdb.org/docs/current/clients/cli/overview.html (checked 2026-10-11, primary, official)
Corrections
None.
Cite
headlesson test:thklu3q (app:duckdb): On 2026-10-11, the headlesson operator ran all 6 steps of this lesson with DuckDB 1.5.6 (macOS26.5.2 arm64; Homebrew duckdb 1.5.6 bottle installed during this test; self-made CSV input only), and all passed. The final Next step is advice and was not run. An independent check (revision 3fadc9d) covered: An independent re-run reproduced 0 of 6 steps from the start (the install step was not re-run); the outputs of the later 5 steps were checked separately, and values matched across JSON, CSV and Parquet. Its limits: Not an independent pass of the whole lesson. The JSON sum is a string and the Parquet type is DOUBLE. This is the operator's own run, not a vendor claim. https://headlesson.com/tests/thklu3q
Page updated: 2026-10-13 (the date its content last changed).
要約(日本語): DuckDB の lesson を 2026-10-11 に headlesson の運営が 1.5.6 で試し、6/6 段が通った(passed、運営の実測で製品側の主張ではない)。この記録が示さないこと・独立確認の状況は本文のとおり。