You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
├── openapi/ # Reference OpenAPI specs (not used at build time)
@@ -89,6 +90,8 @@ dbtp/
89
90
-**Auto-pagination**: `RestClient::paginate_v2` / `paginate_v3` loop through offset-based pages (100 per request) until `total_count` is reached or `--limit` is satisfied.
90
91
-**Envelope unwrapping**: dbt Cloud REST APIs return `{ data, status, extra }`. The client strips this automatically via `unwrap_envelope()`.
91
92
-**Compact mode**: A `compact` output format provides single-line JSON and uses `compact_*` helpers in `api/admin/mod.rs` to reduce verbose API responses to essential fields.
93
+
-**Interactive configure**: `dbtp configure` detects whether stdin is a TTY. In interactive terminals, it fetches projects and environments via the API and offers a numbered selection menu. The `--non-interactive` flag or a non-TTY stdin falls through to plain ID prompts. API errors during interactive configure are handled gracefully with a fallback to manual entry.
94
+
-**Name-or-ID resolution**: `project_id` and `environment_id` accept names or numeric IDs everywhere (config, env vars, CLI flags). `core/resolve.rs` tries `parse::<u64>()` first (zero API calls), then falls back to a list+filter API call with case-insensitive exact matching.
`project_id` and `environment_id` accept either a numeric ID or a name. Names are resolved to numeric IDs via a list+filter API call (case-insensitive exact match). Numeric IDs skip the API call entirely. Resolution happens in `main.rs` before command dispatch, so all downstream code receives numeric IDs.
Copy file name to clipboardExpand all lines: README.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,7 @@
3
3
A fast, ergonomic command-line interface for the [dbt Cloud](https://www.getdbt.com/product/dbt-cloud) platform APIs. Manage accounts, projects, environments, jobs, and runs. Browse your dbt DAG through the Discovery API. Query metrics through the Semantic Layer. All from your terminal.
4
4
5
5
```
6
-
dbtp jobs trigger 48213 --cause "deploy from CI"
7
-
dbtp runs wait 901244 --interval 15
6
+
dbtp jobs trigger 48213 --cause "deploy from CI" --wait
You'll be prompted for your dbt Cloud host, API token, account ID, and (optionally) an environment IDfor Discovery/Semantic Layer commands. Configuration is saved to `~/.config/dbtp/config.toml`.
43
+
You'll be prompted for your dbt Cloud host, API token, account ID, and optionally a project and environment ID. When running in an interactive terminal, `configure` offers a numbered picker for projects and environments so you don't have to look up IDs. Use `--non-interactive` to disable the picker. Configuration is saved to `~/.config/dbtp/config.toml`.
45
44
46
45
### 2. Verify access
47
46
@@ -54,8 +53,11 @@ dbtp accounts list
54
53
```bash
55
54
dbtp projects list
56
55
dbtp jobs list --project-id 12345
56
+
dbtp jobs list --project-id Analytics # name resolution
57
+
dbtp environments list # uses configured project
57
58
dbtp runs show 901244 -o json
58
59
dbtp models list --environment-id 67890
60
+
dbtp models list --environment-id Production # name resolution
59
61
```
60
62
61
63
## Configuration
@@ -73,12 +75,15 @@ output = "table"
73
75
host = "https://cloud.getdbt.com"
74
76
token = "dbtc_..."
75
77
account_id = 51798
78
+
project_id = "12345"# numeric ID or project name
79
+
environment_id = "67890"# numeric ID or environment name
76
80
77
81
[profile.staging]
78
82
host = "https://emea.dbt.com"
79
83
token = "dbtc_..."
80
84
account_id = 99999
81
-
environment_id = 67890
85
+
project_id = "Analytics"# resolved to numeric ID at runtime
86
+
environment_id = "Production"
82
87
```
83
88
84
89
### Environment variables
@@ -88,7 +93,8 @@ environment_id = 67890
88
93
|`DBTP_HOST`| dbt Cloud host URL |
89
94
|`DBTP_TOKEN`| API token (service token or personal access token) |
90
95
|`DBTP_ACCOUNT_ID`| Default account ID |
91
-
|`DBTP_ENVIRONMENT_ID`| Default environment ID (Discovery / Semantic Layer) |
96
+
|`DBTP_PROJECT_ID`| Default project ID or name |
97
+
|`DBTP_ENVIRONMENT_ID`| Default environment ID or name (Discovery / Semantic Layer) |
92
98
93
99
### Precedence
94
100
@@ -170,8 +176,7 @@ dbtp jobs list -o compact | jq '.[].name'
dbtp jobs trigger 48213 --cause "nightly refresh" --wait
175
180
```
176
181
177
182
### Inspect a failed run
@@ -233,10 +238,15 @@ dbtp artifacts get 901244 run_results.json
233
238
|`--host <url>`|| dbt Cloud host URL |
234
239
|`--token <token>`|| API token |
235
240
|`--account-id <id>`|| dbt Cloud account ID |
236
-
|`--environment-id <id>`|| Environment ID (Discovery / Semantic Layer) |
241
+
|`--project-id <id-or-name>`|| Project ID or name |
242
+
|`--environment-id <id-or-name>`|| Environment ID or name (Discovery / Semantic Layer) |
237
243
|`--verbose`|`-v`| Enable verbose output |
238
244
|`--query <jmespath>`|| JMESPath expression to filter JSON output |
239
245
246
+
### Name resolution
247
+
248
+
`--project-id` and `--environment-id` accept either a numeric ID or a project/environment **name**. When a name is given, the CLI resolves it to the numeric ID via a list API call with case-insensitive exact matching. Numeric IDs bypass the API call entirely (zero overhead). The same applies to `DBTP_PROJECT_ID`, `DBTP_ENVIRONMENT_ID`, and the config file values.
-**API version routing** is handled automatically. The v2/v3 split in dbt Cloud's API is invisible to users — each command knows which version to use.
261
271
-**Response envelope unwrapping** — dbt Cloud APIs return responses wrapped in `{ data, status, extra }`. The CLI strips the envelope and presents `data` directly.
262
272
-**Auto-pagination** — `list` commands transparently paginate through all results. Use `--limit` to cap the total.
263
-
-**Waiters** — `dbtp runs wait` polls until a run reaches a terminal state, printing status transitions as they happen.
264
-
265
-
## Releasing
266
-
267
-
Releases are automated via GitHub Actions. To cut a release:
268
-
269
-
```bash
270
-
# Update version in Cargo.toml, then:
271
-
git commit -am "release: v0.1.0"
272
-
git tag v0.1.0
273
-
git push && git push --tags
274
-
```
273
+
-**Waiters** — `dbtp jobs trigger --wait` polls until a triggered run reaches a terminal state, printing status transitions as they happen.
275
274
276
-
The [release workflow](.github/workflows/release.yml) builds binaries for macOS (arm64 + x86_64) and Linux (x86_64 + arm64), then creates a GitHub Release with all artifacts and checksums.
0 commit comments