Getting Started
This guide gets one source working from the CLI. OneQuery keeps credentials server-side; callers use source identifiers like postgres://warehouse.
Prerequisites
Section titled “Prerequisites”Choose one install method. You only need the requirement for that method.
| Install method | Requirement |
|---|---|
| npm or npx | Node.js 22+ |
| Bun or bunx | Bun; Node.js 22+ if you run a local gateway |
| Homebrew | Homebrew |
| Install script | curl and tar; the script manages Node.js runtime |
For source setup, have a OneQuery server URL or local gateway, plus a read-only credential or limited provider token.
Install the CLI
Section titled “Install the CLI”npm install -g @onequery/clibrew install wordbricks/tap/onequerybun add -g @onequery/clicurl -fsSL https://onequery.dev/install.sh | shYou can also run the CLI without a global install:
npx @onequery/cli --helpChoose a Server
Section titled “Choose a Server”Use a shared server URL if your team provides one:
onequery config set api.server_url https://onequery.example.comStart a gateway only when you run OneQuery yourself:
onequery gateway startFirst Run
Section titled “First Run”-
Verify and log in.
Terminal window onequery --versiononequery auth loginonequery auth whoami -
Connect a source.
Replace the placeholders with read-only PostgreSQL credentials.
Terminal window onequery source connect --source postgres \--input '{"sourceKey":"warehouse","credentials":{"host":"db.example.com","port":5432,"database":"app","username":"onequery_readonly","password":"<read-only-password>","sslMode":"require"}}' -
Run a smoke query.
Terminal window onequery query exec --source postgres://warehouse --sql "select 1" -
Confirm the source.
Terminal window onequery source list
You are done when:
onequery auth whoamishows the expected user and organization.onequery source listshows the source you connected.- The smoke query returns one row.
What to Read Next
Section titled “What to Read Next”- Source identifiers explains
postgres://warehouseand other source URI shapes. - Run a query covers read-only query execution.
- Agent workflows shows how to expose OneQuery to coding agents and automation.