DistillQL

Command line

Every command, as distillql COMMAND --help prints it. distillql --version prints the version.

crawl

Read every table and the query history, and write the context: drafted definitions and the review queue.

usage: distillql crawl [-h] [--out OUT] [--sample SAMPLE] config
Argument What it does
CONFIG the config, such as distillql.yaml
--out where to write the context (default .distillql/context.yaml)
--sample rows read from each table to profile it (default 5000)

sql

Run a query and print the head and the explain record.

usage: distillql sql [-h] [--context CONTEXT] [--json] config query
Argument What it does
CONFIG the config, such as distillql.yaml
QUERY one SELECT; tables as engine.schema.table
--context the crawl's output, so metric('name') works
--json print the first rows and the whole explain record as JSON

review

Show the review queue.

usage: distillql review [-h] [--top TOP] [--accept REF] [--sql-file SQL_FILE]
                        [--note NOTE] [--browser] [--port PORT]
                        context
Argument What it does
CONTEXT the crawl's output, such as .distillql/context.yaml
--top how many items to show, most useful first (default 20)
--accept approve a candidate by its review reference
--sql-file exact, reviewed SQL supplying missing business values
--note source or explanation for this approval
--browser open the review page: approve, edit or strike each glossary term with its evidence beside it; Save writes the decisions to the context
--port the local port for --browser (default: any free one)

glossary

Draft the glossary from the crawled context and print it as one page.

usage: distillql glossary [-h] [--max-bytes MAX_BYTES] [--json] [--ossie FILE]
                          [--ossie-version {0.1.1,0.2}]
                          context
Argument What it does
CONTEXT the crawl's output, such as .distillql/context.yaml
--max-bytes the page's size limit; terms that do not fit are listed by name (default 4000)
--json print every entry in full as JSON instead of the page
--ossie also write the measures as an Apache Ossie semantic model to FILE (.json or .yaml), for Snowflake or any tool that reads Ossie; for dbt, use distillql gaps --yaml
--ossie-version 0.1.1 (default), the shape dbt 1.12 and Snowflake write, or the flat 0.2 draft

gaps

Compare the imported dbt project with the query history: numbers dbt lacks, metrics people compute differently, metrics no query uses.

usage: distillql gaps [-h] [--yaml FILE] [--min-runs MIN_RUNS] [--json]
                      context
Argument What it does
CONTEXT the crawl's output, such as .distillql/context.yaml
--yaml write the numbers dbt lacks as dbt metrics to FILE, to check and paste into the project
--min-runs list a number dbt lacks once the history computes it this often (default 3)
--json print the three lists as JSON

demo

Write a sample shop (DuckDB file, query history, config) to try every command.

usage: distillql demo [-h] [folder]
Argument What it does
FOLDER where to write it (default ./distillql-demo)

mcp

Serve the agent tools over MCP on stdin and stdout, or over HTTP (needs distillql[mcp]).

usage: distillql mcp [-h] [--context CONTEXT] [--http] [--port PORT]
                     [--public-url PUBLIC_URL]
                     config
Argument What it does
CONFIG the config, such as distillql.yaml
--context the crawl's output, such as .distillql/context.yaml
--http serve on 127.0.0.1 behind sign-in, for clients that connect by URL
--port the local port for --http (default 8000)
--public-url the https address a tunnel gives this port, for ChatGPT or Claude on the web

init

Set up a database: test the login, keep the password where you choose, crawl, add to Claude Code.

usage: distillql init [-h] [--postgres [URI]] [--service SERVICE]
                      [--duckdb PATH] [--name NAME] [--history PATH]
                      [--user USER] [--ssh DEST] [--password-store WHERE]
                      [--password-env NAME] [--password-command CMD]
                      [--password-stdin] [--crawl | --no-crawl]
                      [--claude | --no-claude] [--yes] [--out OUT] [--force]
Argument What it does
--postgres a Postgres uri; with none, the login comes from PGHOST, PGUSER, PGPASSWORD and ~/.pgpass, as for psql
--service a service name from pg_service.conf
--duckdb a DuckDB file
--name the engine's name in SQL (default postgres, or local for DuckDB)
--history past queries that keep their values: a .jsonl file, .sql files, or a glob such as 'models/*/.sql'
--user who queries (default: your login name)
--ssh reach the database through this SSH jump host, such as ana@bastion (your ~/.ssh/config, keys and ssh-agent apply). TLS settings go in the uri: ?sslmode=verify-full&sslrootcert=...
--password-store where the password is kept: keychain, the system keychain: encrypted, and AI apps you run can read it; env, an environment variable you set: the config names it, for servers and CI; pgpass, ~/.pgpass: Postgres's own password file, plain text that only you can read; command, a command that prints it: 1Password, AWS, Vault, or a cloud sign-in token; prompt, ask each time: nothing saved, but AI apps cannot answer a prompt; config, in distillql.yaml itself: plain text, readable by anything that can read the file; none, nowhere: Postgres finds it as psql does (PGPASSWORD, ~/.pgpass, pg_service.conf)
--password-env for --password-store env: the variable (default PGPASSWORD)
--password-command for --password-store command: a command that prints the password
--password-stdin read the password from the first line of standard input
--crawl, --no-crawl crawl once the login works (asked when run at a terminal; default off otherwise)
--claude, --no-claude add DistillQL to Claude Code when it is installed (asked at a terminal; default off otherwise)
--yes, -y ask nothing: take the defaults and the flags given
--out where to write the config (default distillql.yaml)
--force replace the file if it exists

ask

Answer a question with any LLM through DistillQL's tools; this machine's models unless the config allows another address.

usage: distillql ask [-h] [--model MODEL] [--base-url BASE_URL]
                     [--context CONTEXT] [--json]
                     config question
Argument What it does
CONFIG the config, such as distillql.yaml; its llm: section sets the model and the limits
QUESTION the question, in words
--model the model's name, such as gpt-oss:20b (default: llm.model in the config)
--base-url the OpenAI-compatible address, such as http://localhost:1234/v1 for LM Studio (default: llm.base_url, else Ollama's http://localhost:11434/v1); another machine must be in llm.allow_hosts
--context the crawl's output (default .distillql/context.yaml, else context.yaml, beside the config)
--json print the answer, the SQL, the first rows and the explain record as JSON

check

Connect to every engine in a config and say what the crawl will find.

usage: distillql check [-h] config
Argument What it does
CONFIG the config, such as distillql.yaml