Skip to main content
Use chowder sql to query data from your terminal or a script. Use the same SQL readers and AI column functions as in Python. Results go to stdout.

Run a query

Follow Installation to set up Chowder, then run a query:
Read the first five pages of a hosted document:
Local AI processing may download model artifacts on first use. See Data sources for local paths, object storage, and other supported sources.

Read SQL from a file or stdin

Save a query in query.sql, then export its results:
query.sql
You can pipe SQL into the command or explicitly read stdin with --file -:
Choose one input: inline SQL, --file, or stdin. SQL input must not be empty.

Choose an output format

The default is table when stdout is a terminal and jsonl otherwise. Set --format explicitly in scripts. JSON, JSONL, and CSV emit all rows produced by the query. Table previews can shorten long values; use a machine-readable format for complete values. Use SQL LIMIT to bound the query rather than relying on the preview cap.
The JSON result is:
JSON and JSONL require unique column names. Use SQL aliases to give columns unique names. Nested structs and lists retain their structure in JSON output. CSV encodes them as JSON within a cell and writes nulls as empty cells. Binary values use base64 strings. Dates, times, timestamps, decimals, and non-finite floats use strings; durations use ISO 8601 strings.

Set paths and caching

Use --directory (or -C) to choose the working directory for relative paths. Use --cache-dir to choose the result cache directory:
The command changes directory before reading the SQL file or opening the engine. In this example, query.sql, .chowder-cache, and relative data paths resolve from /path/to/project. Each chowder sql command creates an engine and closes it on exit. Session views do not carry over to a later command. See Caching for result reuse across engines.

Use remote AI compute

Set the engine’s environment variables before launching the command:
Set CHOWDER_API_URL to the endpoint from your Cloud dashboard or self-hosted server operator. A URL and token alone do not enable remote compute. SQL planning and relational execution stay in the CLI process. See Connect to remote AI compute for endpoint settings and Chowder Cloud for account setup.

Handle command failures

The CLI writes query results to stdout and errors to stderr. Scripts can check the exit status: A query can fail after streaming some output. Check the exit status before treating an export as complete. Run chowder --version to check the installed version, or chowder <command> --help for a command’s options. To let an AI agent run queries, see Local MCP server.