{"id":50351015,"url":"https://github.com/apache/doris-cli","last_synced_at":"2026-06-04T02:00:32.098Z","repository":{"id":361075773,"uuid":"1252945188","full_name":"apache/doris-cli","owner":"apache","description":"Agent Doris CLI","archived":false,"fork":false,"pushed_at":"2026-05-30T13:30:03.000Z","size":241,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T01:17:42.021Z","etag":null,"topics":["agent","cli","database","doris","mcp","skills"],"latest_commit_sha":null,"homepage":"https://doris.apache.org","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-29T02:54:05.000Z","updated_at":"2026-06-02T03:01:56.000Z","dependencies_parsed_at":"2026-05-31T23:00:42.860Z","dependency_job_id":null,"html_url":"https://github.com/apache/doris-cli","commit_stats":null,"previous_names":["apache/doris-cli"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/apache/doris-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fdoris-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fdoris-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fdoris-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fdoris-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/doris-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fdoris-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33886160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","cli","database","doris","mcp","skills"],"created_at":"2026-05-29T21:00:46.782Z","updated_at":"2026-06-04T02:00:32.065Z","avatar_url":"https://github.com/apache.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apache Doris CLI\n\nA fast, scriptable CLI for the **Apache Doris kernel**. It connects over the\nMySQL protocol (+ the FE HTTP API), executes, and returns **structured JSON** — a\n\"tool, not a brain\": all the intelligence lives in the layer above (an agent, a\nscript, your shell). Every command prints machine-readable output and exits; there\nare no interactive prompts.\n\nThe binary is `doriscli`.\n\n```bash\ndoriscli sql \"SELECT VERSION()\"\ndoriscli profile get \u003cquery_id\u003e\ndoriscli tablet db.orders --detail\n```\n\n---\n\n## Features\n\n- **SQL execution** — run a query (or a `.sql` file) and get back `query_id`,\n  `exec_time_ms`, `columns`, and `rows` as JSON. Set session variables, toggle the\n  query cache, or enable profiling inline.\n- **Query profile analysis** — fetch and parse Doris query profiles:\n  - a digest by default (summary + plan + operators + table context),\n  - the full parsed tree (`Fragment → Pipeline → Operator` with all counters) with `--full`,\n  - the raw profile text with `--raw`,\n  - **diff** two runs (slow vs. fast) to find the regression,\n  - **history** for a SQL pattern from `audit_log`,\n  - **list** recent or currently-running queries.\n- **Tablet \u0026 bucket analysis** — bucket/tablet distribution for a table, with a\n  `--detail` mode that breaks down per-partition stats, per-tablet rows/size, and the\n  backend mapping (find skew fast).\n- **Multi-environment auth** — save several connections; `auth status` probes the\n  connection and reports the Doris version, backends, and workload groups.\n- **SOCKS5 tunneling** — reach a BYOC / bastioned cluster through a SOCKS5 proxy.\n  Proxy credentials are never written to disk.\n- **Flexible output** — JSON when piped, a pretty table on a TTY, or CSV. Override\n  with `--format`.\n- **Stateless mode** — drive it entirely from environment variables (no files\n  touched), which is ideal for bastions, CI, and multi-tenant hosts.\n\n---\n\n## Install\n\nThe recommended way to install doris-cli is from **npm** — it ships prebuilt\nbinaries, so there is no Rust toolchain and no compile step:\n\n```bash\nnpm install -g @apache-doris/doriscli\ndoriscli --version\n```\n\nOn install, npm pulls **only** the binary that matches your OS + CPU (via\n`optionalDependencies` + `os`/`cpu` constraints). Supported platforms: macOS\n(arm64), Linux (x64, arm64). The published package is scoped\n(`@apache-doris/doriscli`), but the installed command is just `doriscli`.\n\nFor any other platform — or to hack on doris-cli itself — build from source below.\n\n---\n\n## Build\n\nRequires a recent stable Rust toolchain (verified on rustc 1.87; the crate uses the\nMSRV-aware resolver and pins a few dependencies for older toolchains).\n\n```bash\ncargo build --release          # produces target/release/doriscli\ncargo run --release -- --version\ncargo test                     # unit tests\n```\n\nPut the binary on your `PATH`:\n\n```bash\ncp target/release/doriscli /usr/local/bin/\n```\n\n---\n\n## Quick start\n\n```bash\n# 1. Save a connection (\"prod\" is just a name you choose)\ndoriscli auth add prod --host 127.0.0.1 --port 9030 --http-port 8030 \\\n  --user root --password 'secret'\n\n# 2. Verify it (version, backends, workload groups, HTTP health)\ndoriscli --env prod auth status\n\n# 3. Query\ndoriscli --env prod sql \"SELECT COUNT(*) FROM db.orders\"\n```\n\nThe first environment you add becomes the default, so `--env` is optional until you\nhave more than one. Switch the default any time with `doriscli use \u003cname\u003e`.\n\n---\n\n## Commands\n\n### `auth` — manage connections\n\n```bash\ndoriscli auth add \u003cname\u003e --host \u003ch\u003e --user \u003cu\u003e --password \u003cp\u003e [--port 9030] [--http-port 8030]\ndoriscli auth add \u003cname\u003e --mysql \"mysql://user:pass@host:9030\"   # URI form\ndoriscli auth list\ndoriscli auth status            # test connection + cluster info\ndoriscli auth remove \u003cname\u003e\n```\n\n`auth add` probes the FE HTTP port and, if it doesn't answer, suggests common\nalternatives (8080 for cloud FEs, 8030/8040 for self-hosted Apache Doris) so `profile`\ncommands work later.\n\n### `sql` — execute queries\n\n```bash\ndoriscli sql \"SELECT * FROM db.t LIMIT 10\"\ndoriscli sql -f migration.sql\ndoriscli sql \"SELECT ...\" --profile            # SET enable_profile=true first\ndoriscli sql \"SELECT ...\" --no-cache           # bypass the SQL cache (benchmarking)\ndoriscli sql \"SELECT ...\" --set \"exec_mem_limit=8g\" --set \"parallel_pipeline_task_num=8\"\n```\n\nOutput:\n\n```json\n{\n  \"query_id\": \"f1e2...\",\n  \"exec_time_ms\": 42,\n  \"rows_returned\": 10,\n  \"columns\": [\"id\", \"name\"],\n  \"rows\": [{ \"id\": 1, \"name\": \"a\" }]\n}\n```\n\n### `profile` — analyze query profiles\n\n```bash\ndoriscli profile list [--limit 20] [--active]      # recent, or running queries\ndoriscli profile get \u003cquery_id\u003e                    # summary + plan + operators\ndoriscli profile get \u003cquery_id\u003e --full             # full Fragment→Pipeline→Operator tree\ndoriscli profile get \u003cquery_id\u003e --raw              # raw profile text\ndoriscli profile get \u003cquery_id\u003e -f exported.txt    # parse a profile saved from the web UI\ndoriscli profile diff \u003cslow_qid\u003e \u003cfast_qid\u003e        # compare two runs\ndoriscli profile history \"\u003csql substring\u003e\" [--days 7] [--limit 50]\n```\n\n### `tablet` — bucket / tablet distribution\n\n```bash\ndoriscli tablet db.orders                          # overview\ndoriscli tablet db.orders --detail                 # per-partition + per-tablet + backends\ndoriscli tablet db.orders --detail --partition p20240101\n```\n\n### `use` — switch the default environment\n\n```bash\ndoriscli use            # show current + list environments\ndoriscli use staging    # make \"staging\" the default\n```\n\n---\n\n## Global options\n\n| Option | Description |\n|---|---|\n| `--env \u003cname\u003e` | Which saved environment to use (default: `default`, or `$DORIS_ENV`). |\n| `--format \u003cjson\\|table\\|csv\u003e` | Force the output format. Default: table on a TTY, JSON when piped. |\n| `--socks5 \u003cuser:pass@host:port\u003e` | Route the connection through a SOCKS5 proxy (BYOC). |\n| `--init-sql \u003csql\u003e` | Run a statement right after connecting (e.g. `USE @\u003ccompute-group\u003e`). Overrides `$DORIS_INIT_SQL`. |\n\n---\n\n## Configuration \u0026 environment variables\n\nSaved environments live in `~/.doris/`:\n\n- `~/.doris/config.toml` — host, ports, user, per-environment.\n- `~/.doris/credentials.toml` — passwords (written `0600`).\n\nEvery setting can also come from the environment (prefix `DORIS_`), which takes\nprecedence over the config files:\n\n| Variable | Meaning | Default |\n|---|---|---|\n| `DORIS_HOST` | FE host | — |\n| `DORIS_USER` | MySQL user | — |\n| `DORIS_PASSWORD` | MySQL password | empty |\n| `DORIS_PORT` | MySQL/query port | `9030` |\n| `DORIS_HTTP_PORT` | FE HTTP port | `8030` |\n| `DORIS_ENV` | Which environment to use | `default` |\n| `DORIS_INIT_SQL` | Statement run after connect | — |\n| `DORIS_SOCKS5_HOST` / `_PORT` / `_USER` / `_PASS` | SOCKS5 proxy (BYOC) | user/pass default to `admin` |\n\n**Stateless mode:** when both `DORIS_HOST` and `DORIS_USER` are set, doris-cli\nconnects purely from environment variables and never reads or writes any file —\ndesigned for bastions, CI, and multi-tenant hosts where `$HOME` may not be writable.\n\n```bash\nDORIS_HOST=fe.internal DORIS_USER=admin DORIS_PASSWORD=*** \\\n  doriscli sql \"SELECT 1\"\n```\n\n---\n\n## Connecting to a cloud-hosted kernel\n\ndoris-cli talks to any reachable Doris FE — including a cloud cluster — as long as\nyou give it the resolved host/port. Compute-group routing is handled\nby `--init-sql` (or `DORIS_INIT_SQL`), which runs `USE @\u003ccompute-group\u003e` right after\nconnecting:\n\n```bash\nDORIS_HOST=\u003cresolved-host\u003e DORIS_PORT=\u003cport\u003e DORIS_USER=admin DORIS_PASSWORD=*** \\\nDORIS_INIT_SQL='USE @my_compute_group' \\\n  doriscli sql \"SELECT 1\"\n```\n\n---\n\n## Output formats\n\n- **TTY** → a pretty table.\n- **Piped / redirected** → JSON (so `| jq` and scripts just work).\n- Force either, or CSV, with `--format json|table|csv`.\n\n```bash\ndoriscli --env prod sql \"SHOW BACKENDS\" --format table\ndoriscli --env prod sql \"SELECT * FROM db.t\" | jq '.rows[] | .id'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fdoris-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fdoris-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fdoris-cli/lists"}