Configuration
A config is a YAML file, usually distillql.yaml. distillql init writes one. ${NAME} and $NAME anywhere in engines and identity are read from the environment, and an unset one is an error.
A secret, such as password or token, can come from the environment, the system keychain, a command or a prompt, or be typed in. A secret typed in works but brings a warning. See where the password comes from.
engines:
sales: {kind: duckdb, path: sales.duckdb, history: sales-queries.jsonl}
app: {kind: postgres, service: analytics, history: "dbt/target/compiled/**/*.sql", dbt: ~/analytics}
identity:
user: ana
credentials:
app: {login: true}
caps: {rows: 1000000, bytes: 500000000}
write_dir: ./exports
Top level
| Key |
What it sets |
engines |
Each database, by the name SQL uses for it. |
identity |
Who is asking, and their credential for each engine. |
metrics |
Named definitions that SQL can call as metric('name'). |
caps |
Limits checked before a query runs. |
cache |
true keeps each result per user, keyed on the query and the policies in force. Off by default. |
write_dir |
The one folder the write tool may put files in. Without it, write makes local tables only. |
llm |
The model distillql ask uses, and the limits on what it may see. See LLM. |
local_files |
true lets the local DuckDB that joins results read files and reach the network, for SQL such as read_parquet('data/*.parquet'). Off by default, so a query cannot read /etc/hosts or a key file. |
Every engine
| Key |
What it sets |
kind |
duckdb, postgres, trino, snowflake, bigquery or databricks. Defaults to the engine's name. |
history |
DuckDB, Postgres and Trino only. Past queries that keep their values: a path or a glob, or a list of them. .jsonl files hold {"sql": ..., "calls": ..., "user": ...} per line; other files hold SQL separated by semicolons. Snowflake, BigQuery and Databricks read their own query logs and take no history key. |
dbt |
A dbt project folder, or its target/ folder. The crawl reads its metrics, descriptions and tests. See definitions from dbt. |
ossie |
An Apache Ossie semantic model: a .json or .yaml file, or a folder of them, such as dbt's target/osi_document.json or a Snowflake semantic view exported as Ossie. See definitions from Apache Ossie. |
lookml |
A LookML project's folder, or one .lkml file. The crawl reads its measures, dimensions and explore joins; no Looker instance is needed. See definitions from LookML. |
datahub |
A DataHub server: {url: ..., token: ..., platform: ..., database: ..., env: ...}, or a saved file of its responses. The crawl reads its glossary terms, descriptions and saved queries. See definitions from DataHub and OpenMetadata. |
openmetadata |
An OpenMetadata server: {url: ..., token: ..., service: ..., database: ...}, or a saved file of its responses. The crawl reads its glossary terms, metrics, descriptions and saved queries. See definitions from DataHub and OpenMetadata. |
DuckDB
| Key |
What it sets |
path |
The DuckDB file. Defaults to an in-memory database. |
read_only |
A file that exists opens read-only unless this is false. A file that does not exist yet is created read-write. |
Postgres
| Key |
What it sets |
uri |
A postgresql:// URI or a libpq keyword string. Without it, libpq reads the PG* variables and ~/.pgpass. |
service |
A service name from pg_service.conf. |
password |
The password, from any source. Without it, libpq looks in PGPASSWORD and ~/.pgpass. |
sslpassword |
The passphrase of an encrypted client key, from any source. TLS settings themselves (sslmode, sslrootcert, sslcert, sslkey) go in the URI. |
ssh |
A jump host to tunnel through: ana@bastion, or {destination, port, identity_file, options}. See jump hosts. |
allow_functions |
Functions a query may call beyond the ones DistillQL knows. Under any login, DistillQL refuses functions that act outside the read-only transaction (dblink_exec, file and large-object functions, advisory locks, set_config, nextval, pg_terminate_backend and others) unless this names them. |
Trino
engines:
lake:
kind: trino
host: trino.example.com
catalog: hive
crawler: {user: distillql, password: {keyring: [email protected]}}
| Key |
What it sets |
host |
The coordinator's host. |
port |
Its port. Defaults to 443 over HTTPS and 8080 over HTTP. |
catalog |
The Trino catalog to read. In SQL, hive.sales.orders and lake.sales.orders name the same table. |
schemas |
The schemas to read. Defaults to all but information_schema. |
http_scheme |
https or http. Defaults to https, and to http when the host is this machine and the crawler holds no password or token. A password goes only over HTTPS. |
verify |
false, or the path of a CA bundle, for a server whose certificate your system does not trust. |
roles |
Trino roles to set for each query, by catalog: {hive: analyst}. |
crawler |
The login the crawl uses to read the schema and query history, and that sends a person's name when they hold no credential of their own: {user: ..., password: ...} or {user: ..., token: ...}. |
A person's credential is {user: ..., password: ...}, {token: ...} for a JWT, {oauth: true} for a browser
sign-in, {user: ...} to act as another Trino user through the crawler's login, or {login: true} to run as the
crawler itself. Without one, the crawler's login sends the person's own name. Each query's time limit is set with
Trino's query_max_run_time, and a table function that sends its text to the database underneath, such as
postgresql.system.query, is refused.
Snowflake (experimental)
| Key |
What it sets |
account |
The account identifier, such as xy12345.us-east-1. |
database |
The database to read. |
warehouse |
The warehouse queries run on. |
crawler |
The credential the crawl uses to read the schema and query history. |
A person's credential is {token: ...} for OAuth, {user: ..., private_key_file: ...} for key-pair login, or {role: ...}.
BigQuery
| Key |
What it sets |
project |
The Google Cloud project that holds the datasets. Queries run and bill there unless billing_project is set. |
billing_project |
The project that runs and pays for the jobs, when the datasets belong to another, such as bigquery-public-data. Table names in SQL still mean project's tables, and the query history is read from this project's jobs on them. |
datasets |
The datasets to read. Defaults to all of them. |
location |
Where the datasets live, such as US or EU. Defaults to the first dataset's location. The crawl reads query history from this region. |
maximum_bytes_billed |
A query whose dry run is over this is refused before it runs; BigQuery refuses any other that would bill more. Neither bills anything. It applies to the crawl's own queries too. BigQuery bills at least 10 MB for each table a query reads, so set it above that. |
crawl_bytes_billed |
The most one of the crawl's own queries may bill: a table's date range, a view's sample, the query history. Default 1000000000 (1 GB). The crawl dry-runs each first and skips one over this, with a note. |
crawler |
The credential the crawl uses to read the schema and query history. |
A person's credential is {credentials: ...} (a Google credentials object, from the Python API), {token: ...} for an OAuth
access token, {service_account_file: ...}, or {impersonate: <service account email>}. Without one, the client
library's application default login is used. impersonate needs no key file: the application default login must hold
Service Account Token Creator on that account, and each token lasts an hour and renews itself.
A person who may not open Storage Read API sessions (bigquery.readsessions.create, which BigQuery Job User and Data
Viewer leave out) gets the rows through the REST API instead, which is slower for large results.
The crawl reads tables and keys through the BigQuery API and samples rows through the table-read API, so neither bills.
Two crawl steps are queries, and BigQuery bills them by the columns they read: a table's first and last date when the
sample did not hold the whole table (min and max of one date column, 8 bytes a row), and the sample of a view,
which the table-read API cannot read. Each is dry-run first and skipped over crawl_bytes_billed, and the notes say
so: on the public crypto_bitcoin dataset, sampling three of its four views would have billed 1.4 to 2.6 TB each.
Query history comes from INFORMATION_SCHEMA.JOBS: finished SELECTs of the last 180 days that read the configured
datasets, with their run counts. It leaves out jobs labelled distillql and SQL carrying DistillQL's tag; every job
DistillQL starts carries both. Reading the whole project's jobs needs bigquery.jobs.listAll; without it the crawl
reads only the crawler's own jobs and says so.
Databricks (experimental)
| Key |
What it sets |
server_hostname |
The workspace host. |
http_path |
The SQL warehouse's HTTP path. |
catalog |
The Unity Catalog catalog to read. |
crawler |
The credential the crawl uses to read the schema and query history. |
A person's credential is {token: ...}.
Identity
| Key |
What it sets |
user |
Who is asking. Defaults to DISTILLQL_USER, then your login name. |
credentials |
For each engine, how this person's queries run. On Postgres: {login: true}, {uri: ..., password: ...} or {role: ...}. See whose rights each query uses. |
Metrics
metrics:
net_revenue:
engine: sales
table: main.orders
expression: "sum(amount) - sum(refunds)"
description: "Order value after refunds"
| Key |
What it sets |
engine |
The engine the metric reads. |
table |
Its table, as schema.table. |
expression |
SQL over that table's columns. |
description |
What it means, in words. |
Caps
| Key |
What it sets |
rows |
Refuse a part whose estimate is over this many rows. |
bytes |
Refuse a part whose estimate is over this many bytes. |
strict |
true refuses when an engine gives no estimate, and checks the worst case before anything runs. Otherwise DistillQL warns and runs. |
timeout_seconds |
How long one query may run, on each engine and in the local join. 0 means no limit. Unset, the Python API has no limit and the agent tools stop a query after 60 seconds. |
result_rows |
The most rows a result keeps. Past it, the rest are cut and the record says how many. 0 means no limit. Unset, the Python API keeps every row and the agent tools keep 100,000. |
LLM
The llm: section sets the model for distillql ask and loosens or tightens its limits. Flags on the command line can pick the model and the address, never loosen a limit.
llm:
base_url: http://localhost:1234/v1 # LM Studio
model: qwen3.5-27b
max_rows: 10
never_send: [customers.region, "hr.*"]
| Key |
What it sets |
base_url |
The OpenAI-compatible address. Defaults to Ollama on this machine, http://localhost:11434/v1. |
model |
The model's name. --model overrides it. |
api_key_env |
The environment variable that holds the key. A key typed under llm: stops the run. |
allow_hosts |
Hosts other than this machine that may receive the question and tool results. Each must use https. |
max_rows |
The most rows of a tool result the model sees (default 20, at most 1,000). 0 sends none. |
send_rows |
false sends column names and counts only; DistillQL prints the final query's rows itself. |
never_send |
More columns whose values are never sent, as table.column, column or a pattern such as hr.*. |
send_columns |
Columns to let through the personal-name check and the crawl's personal tag, such as orders.zip_code. never_send wins over it. |
max_turns |
The most replies from the model a question (default 15). |
max_tool_calls |
The most tool calls a question (default 30). |
timeout_seconds |
The most time a question takes (default 300). |
max_output_tokens |
The most one reply may hold, thinking included (default 8,192). A reasoning model on a high setting can otherwise think for many minutes. |
temperature |
Passed to the model as set. Unset, the server's default applies; 0 can make a reasoning model such as gpt-oss repeat itself until its reply is cut off. |
reasoning_effort |
low, medium or high, for models that take one, such as gpt-oss. Unset, the server's default applies; LM Studio's gives gpt-oss little room to think. |
log |
Where each request is logged (default .distillql/ask-log.jsonl beside the config). |