Skip to content

feat(athena): Part 9 — dbt init profile wizard for Athena - #16375

Open
aoelvp94 wants to merge 3 commits into
dbt-labs:mainfrom
aoelvp94:athena/part-9-init-wizard
Open

aoelvp94 wants to merge 3 commits into
dbt-labs:mainfrom
aoelvp94:athena/part-9-init-wizard

Conversation

@aoelvp94

@aoelvp94 aoelvp94 commented Sep 18, 2026 •

Copy link
Copy Markdown

Part of #16252. Related: #13822. Built on top of #16274 because it needs AthenaDbConfig; the first commit in this PR is that one, review the last 2. If #16274 merges first, a rebase drops it.

Problem

dbt init with Athena selected panics on the last todo!("Athena"), in dbt-init's profile setup. Athena is also absent from the adapter list and from the headless profile API.

Solution

AthenaDbConfig gains an InteractiveSetup in dbt-profile-schemas, shaped like the Exasol and BigQuery ones. Prompts and defaults follow dbt-athena's profile_template.yml (region, staging dir, optional data dir, catalog defaulting to awsdatacatalog, schema, threads: 1), plus an optional workgroup and an auth-method selector the template lacks because it assumes ambient credentials: default credential chain, named AWS profile, or access key pair with secrets prompted as passwords. Choosing a method clears the other methods' fields, because AthenaAuth resolves keys before a profile name and a stale pair in an edited profile would silently win.

Athena joins get_available_adapters() in dbt-init and supported_adapters() / build_profile_target() in the headless API.

Verification

  • cargo nextest run -p dbt-profile-schemas: four tests on the headless path, which shares the field logic with the wizard and needs no terminal: default chain writes no credentials and ignores the conditional prompts; each method collects only its own fields; switching method on an existing profile drops the previous credentials.
  • cargo clippy -p dbt-profile-schemas -p dbt-init --all-targets --all-features clean.

Feedback wanted: threads defaults to 1 to match dbt-athena's template; the other Fusion wizards default to 16.

Sequence (independent PRs, each compiles alone against main)

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (new wizard arm only).

fpiped and others added 3 commits September 18, 2026 12:22
Add the `athena` variant of `DbConfig` so Athena profiles parse and reach
the experimental-adapter gate and `dbt-auth`, which already carry the
Athena pieces (`AdapterType::Athena`, `Backend::Athena`, `AthenaAuth`).

`AthenaDbConfig` declares every field of dbt-athena's `AthenaCredentials`,
including the ones `AthenaAuth` rejects today: the auth layer reads the
profile through `to_mapping()`, so an undeclared field would be dropped
silently instead of raising the "not yet supported" error. `catalog` is
accepted as an alias of `database`, matching dbt-athena.

`connection_keys_for(Athena)` lists the honoured, non-secret keys.
`TargetContext::Athena` exposes `region_name`, `s3_staging_dir`,
`work_group`, `aws_profile_name` and the common fields, with `database`
defaulting to `awsdatacatalog` as in `AthenaAuth`; threads parsing goes
through `threads_from_profile`.

The relation factory builds the generic `RelationStatic` for Athena, as
for every other adapter, so `dbt parse` and `dbt ls` stop at a
configuration error naming the missing `dbt-athena` macro package instead
of a `todo!` panic.

Athena stays outside `NON_EXPERIMENTAL_ADAPTERS`. The remaining
`todo!("Athena")` arms in `dbt-adapter` and the macro package are left
for follow-ups.

Resolves dbt-labs#16252
Fills the last todo!("Athena"), in dbt-init's profile setup, so `dbt init`
can create and update an Athena profile.

`AthenaDbConfig` gains an `InteractiveSetup` in dbt-profile-schemas, shaped
like the Exasol and BigQuery ones. The prompt set and defaults follow
dbt-athena's profile_template.yml (region, staging dir, optional data dir,
catalog defaulting to awsdatacatalog, schema, threads 1), plus an optional
workgroup and an auth-method selector the template lacks because it assumes
ambient credentials:

- default credential chain (nothing written),
- named AWS profile (`aws_profile_name`),
- access key pair (`aws_access_key_id`, `aws_secret_access_key`, optional
  `aws_session_token`), secrets prompted as passwords.

Picking a method clears the other methods' fields. AthenaAuth resolves keys
before a profile name, so a stale pair left in an edited profile would
silently override the chosen profile.

Athena joins the adapter list in dbt-init and the headless (non-interactive)
API in dbt-profile-schemas, with the same threads default.

Tests cover the headless path, which shares the field logic with the wizard
and needs no terminal: default chain writes no credentials and ignores the
conditional prompts, each method collects only its own fields, and switching
method on an existing profile drops the previous credentials.

Verified with `cargo test --release -p dbt-profile-schemas` (4 passed) and
`cargo clippy --release -p dbt-profile-schemas -p dbt-init --all-targets
--all-features` clean for both crates.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants