ducklocal schema ./data/Discover relations
List files, tables, views and their columns before writing SQL.
Give Claude Code, Codex, Cursor and other coding agents a headless DuckDB workflow for CSV, Parquet, JSON and DuckDB data. No GUI automation, database server or custom API required.
The CLI prints JSON by default and uses explicit exit codes for arguments, SQL and I/O failures.
The official workflow keeps an agent from guessing column names or treating a partial preview as the whole dataset.
Run ducklocal schema ./data/ to get relations, query-ready FROM expressions, columns and types. Large catalogs return a summary with hints for drilling down.
Use one SQL statement and a small --limit to inspect representative rows. Check the command’s exit status and the JSON truncated field.
Run filters, joins and aggregates in DuckDB rather than summing a truncated preview in the agent context. Return only the evidence the answer needs.
Each invocation creates a dedicated DuckDB connection, validates that the input contains exactly one statement and writes a machine-readable result to stdout. Errors are JSON on stderr with a nonzero exit code.
$ ducklocal query --sql \ "SELECT channel, round(sum(revenue), 2) AS revenue FROM 'sales.csv' GROUP BY channel ORDER BY revenue DESC" {"columns":[...], "rows":[["Mobile app",290549.76],...], "row_count":4, "truncated":false, "elapsed_ms":14}
ducklocal schema ./data/List files, tables, views and their columns before writing SQL.
ducklocal schema sales.csv --statsGet exact nulls, distinct values, ranges, medians and date coverage.
ducklocal query --sql "…"Receive typed JSON by default, or a Markdown table with --format md.
ducklocal open --title "…" --run --sql "…"Open a query in the desktop app when the result needs review or further exploration.
The default return limit is 1,000 rows, with an additional 2,000,000-cell budget. DuckLocal reads one extra row to determine whether the response was cut short and exposes that as truncated.
Queries such as GROUP BY, ORDER BY and aggregates still compute over the full input before returning their bounded result.
row_count, truncated and elapsed_msThe open-source DuckLocal skill teaches an agent to inspect the schema, preview a bounded sample, aggregate in SQL, verify truncation and answer from returned values. Install it for Claude Code from the app, or copy the same brief into another coding agent.
DuckLocal does not upload local files to a DuckLocal service, but it does not pretend arbitrary SQL is harmless. Read-only database mode is not a filesystem or network sandbox: SQL such as COPY, extension installation or explicit external access can have side effects.
--read-write only for an intentional database changeducklocal --help before relying on a commandNeed the visual workflow instead? See local data analysis in the desktop app →
ducklocal schema to discover relations and columns, then ducklocal query with one SQL statement. The command returns structured JSON by default without opening the desktop window or starting a server.ducklocal query invocation accepts exactly one SQL statement. Multi-statement scripts are rejected rather than partially executed, which makes each tool call easier to inspect.Install DuckLocal, put the command on your PATH and start by asking what is actually in the data.