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
feat: support custom dbt profiles.yml path via DBT_PROFILES_DIR and project-local discovery (#605)
Closes#604
- Add `resolveProfilesPath()` with dbt-standard priority: explicit path > `DBT_PROFILES_DIR` env var > project-local `profiles.yml` > `<home>/.dbt/profiles.yml`
- Warn when `DBT_PROFILES_DIR` is set but `profiles.yml` not found (graceful fallthrough)
- Add `projectDir` param to `DbtProfilesParams` and expose in tool schema
- Pass detected dbt project path from `project-scan` to `dbt.profiles`
- Use `path.join(homedir(), ".dbt", "profiles.yml")` for OS-independent paths
- Add 4 unit tests + 35 E2E tests covering priority chain, edge cases, adapter mapping
- Update 6 doc files with platform-neutral path notation
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`/discover` auto-detects dbt projects, warehouse connections (from `~/.dbt/profiles.yml`, Docker, environment variables), and installed tools (dbt, sqlfluff, airflow, dagster, and more). Skip this and start building — you can always run it later.
50
+
`/discover` auto-detects dbt projects, warehouse connections (from `profiles.yml` — checks `DBT_PROFILES_DIR`, project directory, then `<home>/.dbt/`; plus Docker and environment variables), and installed tools (dbt, sqlfluff, airflow, dagster, and more). Skip this and start building — you can always run it later.
51
51
52
52
> **Headless / scripted usage:**`altimate --yolo` auto-approves all permission prompts. Not recommended with live warehouse connections.
| Environment variables | Scans for `SNOWFLAKE_ACCOUNT`, `PGHOST`, `DATABRICKS_HOST`, etc. |
473
473
474
+
### dbt profiles.yml resolution order
475
+
476
+
When discovering dbt profiles, altimate checks the following locations **in priority order** and uses the first one found:
477
+
478
+
| Priority | Location | Description |
479
+
|----------|----------|-------------|
480
+
| 1 | Explicit path | If you pass a `path` parameter to the `dbt_profiles` tool |
481
+
| 2 |`DBT_PROFILES_DIR` env var | Standard dbt environment variable — set it to the directory containing your `profiles.yml`|
482
+
| 3 | Project-local `profiles.yml`| A `profiles.yml` in your dbt project root (next to `dbt_project.yml`) |
483
+
| 4 |`<home>/.dbt/profiles.yml`| The global default location (e.g., `~/.dbt/` on macOS/Linux, `%USERPROFILE%\.dbt\` on Windows) |
484
+
485
+
This means teams that keep `profiles.yml` in their project repo (a common pattern for CI/CD) will have it detected automatically — no extra configuration needed.
486
+
487
+
```bash
488
+
# Option 1: Set the environment variable
489
+
export DBT_PROFILES_DIR=/path/to/your/project
490
+
491
+
# Option 2: Just put profiles.yml next to dbt_project.yml
492
+
# Copy from default location (macOS/Linux)
493
+
cp ~/.dbt/profiles.yml ./profiles.yml
494
+
altimate /discover
495
+
```
496
+
474
497
See [Warehouse Tools](../data-engineering/tools/warehouse-tools.md) for the full list of environment variable signals.
Copy file name to clipboardExpand all lines: docs/docs/getting-started/quickstart-new.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,13 +34,13 @@ altimate
34
34
35
35
### Option A: Auto-detect from dbt profiles
36
36
37
-
If you have `~/.dbt/profiles.yml`configured:
37
+
If you have a `profiles.yml`— either in your home directory's `.dbt/` folder, in your project repo, or pointed to by `DBT_PROFILES_DIR`:
38
38
39
39
```bash
40
40
/discover
41
41
```
42
42
43
-
Altimate reads your dbt profiles and creates warehouse connections automatically. You'll see output like:
43
+
Altimate searches for `profiles.yml` in this order: `DBT_PROFILES_DIR` env var → project root (next to `dbt_project.yml`) → `<home>/.dbt/profiles.yml`. It reads your dbt profiles and creates warehouse connections automatically. You'll see output like:
Copy file name to clipboardExpand all lines: docs/docs/getting-started/quickstart.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,7 @@ You can also set a smaller model for lightweight tasks like summarization:
189
189
altimate /discover
190
190
```
191
191
192
-
Auto-detects your dbt projects, warehouse credentials from `~/.dbt/profiles.yml`, running Docker containers, and environment variables (`SNOWFLAKE_ACCOUNT`, `PGHOST`, `DATABASE_URL`, etc.).
192
+
Auto-detects your dbt projects, warehouse credentials from `profiles.yml` (checks `DBT_PROFILES_DIR`, then your project directory, then the default `<home>/.dbt/profiles.yml`), running Docker containers, and environment variables (`SNOWFLAKE_ACCOUNT`, `PGHOST`, `DATABASE_URL`, etc.).
1.**If using dbt:** Run `altimate-dbt init` to set up the dbt integration. The CLI will use your `profiles.yml`automatically, so no separate connection config is needed.
58
+
1.**If using dbt:** Run `/discover` — it automatically finds your `profiles.yml` from `DBT_PROFILES_DIR`, your project directory, or `<home>/.dbt/profiles.yml`. If your `profiles.yml`is in a custom location, set `DBT_PROFILES_DIR` to the directory containing it.
59
59
2.**If not using dbt:** Add a connection via the `warehouse_add` tool, `~/.altimate-code/connections.json`, or `ALTIMATE_CODE_CONN_*` env vars.
60
60
3. Test connectivity: use the `warehouse_test` tool with your connection name.
61
61
4. Check that the warehouse hostname and port are reachable
62
-
3. Verify the role/user has the required permissions
63
-
4. For Snowflake: ensure the warehouse is not suspended
64
-
5. For BigQuery: check that the service account has the required IAM roles
62
+
5. Verify the role/user has the required permissions
63
+
6. For Snowflake: ensure the warehouse is not suspended
64
+
7. For BigQuery: check that the service account has the required IAM roles
"Discover dbt profiles from profiles.yml and map them to warehouse connections. Auto-detects Snowflake, BigQuery, Databricks, Postgres, Redshift, MySQL, DuckDB configurations.",
12
+
`Discover dbt profiles from profiles.yml and map them to warehouse connections. Auto-detects Snowflake, BigQuery, Databricks, Postgres, Redshift, MySQL, DuckDB configurations. Searches: explicit path > DBT_PROFILES_DIR env var > project-local profiles.yml > ${DEFAULT_DBT_PROFILES}.`,
9
13
parameters: z.object({
10
-
path: z.string().optional().describe("Path to profiles.yml (defaults to ~/.dbt/profiles.yml)"),
14
+
path: z.string().optional().describe(`Explicit path to profiles.yml. If omitted, checks DBT_PROFILES_DIR, then project directory, then ${DEFAULT_DBT_PROFILES}`),
15
+
projectDir: z.string().optional().describe("dbt project root directory. Used to find project-local profiles.yml next to dbt_project.yml"),
0 commit comments