DuckDB CLI
$ duckdb Foundation Low RiskDuckDB's standalone CLI lets AI agents run standard SQL queries directly over local CSV, Parquet, JSON, or SQLite files without spinning up a database server. Supports -json, -readonly, and non-interactive -c execution.
brew install duckdb duckdb -json -c "SELECT ..." runs analytical SQL over gigabytes of CSV/Parquet locally in one command without loading data into agent memory or an MCP process.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Provides -json / -jsonlines, -c non-interactive one-shot execution, -readonly, and clean tabular/JSON switching.
- Supports
-json,-c, and-readonlyCLI flags
In-process sandboxed analytical engine with -readonly mode and :memory: default; optional httpfs / file writes are explicit SQL statements.
- Defaults to ephemeral
:memory:DB and supports-readonly
Single standalone C++ binary via Homebrew or direct download with zero runtime dependencies.
- Zero-dependency static CLI binary
Gives agents instant SQL superpowers over CSV, Parquet, JSON, and SQLite without writing throwaway Python scripts.
- Direct SQL querying on CSV/Parquet/JSON files
Backed by DuckDB Foundation (duckdb/duckdb) under MIT license.
- Official
duckdb/duckdbrepository
Clear CLI reference and SQL documentation.
- Official CLI overview at duckdb.org/docs/api/cli/overview
Security, Auth & Guardrails
None required for local files; optional S3/HTTP secrets configured via SQL CREATE SECRET or env vars.
100% free and MIT open-source; local execution incurs zero API fees.
# DuckDB CLI Agent Rules - Always pass `-json` and `-c "<sql>"` (never start interactive REPL without `-c`). - Pass `-readonly` when querying existing `.duckdb` database files. - Always `LIMIT` row-level `SELECT` queries and inspect schemas first with `DESCRIBE`.
Agent-Ready Command Recipes
Safe Read-Only Queries
duckdb -json -c "DESCRIBE SELECT * FROM 'data.parquet';"
Inspects column names and types as clean JSON without reading all rows.
duckdb -readonly -json -c "SELECT status, count(*) AS n FROM 'events.ndjson' GROUP BY 1 ORDER BY 2 DESC LIMIT 10;"
Runs fast analytical aggregation locally and outputs compact JSON.
Controlled Writes & Previews
duckdb -c "COPY (SELECT * FROM 'input.csv') TO 'output.parquet' (FORMAT PARQUET);"
Performs a deterministic local file format conversion.
Strengths for Agents
- + Replaces brittle ad-hoc Python/awk parsing with standard SQL +
-jsonoutput. - + Single binary runs in-process over CSV, Parquet, and NDJSON in milliseconds.
- +
-readonlyand:memory:make exploratory data analysis safe by default.
Caveats & Pitfalls
- ! Invoking
duckdbwithout-copens an interactive SQL shell—always pass-cor pipe SQL via stdin.