Skip to content

fix: expand env_var substitution in profile option values#20

Merged
esadek merged 1 commit into
columnar-tech:mainfrom
theiotidiot:fix/profile-env-var-substitution
Jul 8, 2026
Merged

fix: expand env_var substitution in profile option values#20
esadek merged 1 commit into
columnar-tech:mainfrom
theiotidiot:fix/profile-env-var-substitution

Conversation

@theiotidiot

Copy link
Copy Markdown
Contributor

Summary

When connecting via databow --profile NAME, option values that use the ADBC {{ env_var(NAME) }} substitution template are forwarded to the driver as literal strings instead of being expanded against the process environment. Profiles that lean on env-var substitution to inject credentials or URIs (per the ADBC connection-profile spec) therefore fail at connect time.

adbc_driver_manager performs this substitution along its DriverLocator::Profile path (via process_profile_value), but initialize_profile_connection loads the profile through FilesystemProfileProvider directly and skips that step. This patch applies process_profile_value to every OptionValue::String returned by the profile, matching the driver manager's own behavior.

Test plan

  • Added test_profile_env_var_substitution integration test that points DuckDB at a database file whose name comes from an env var and asserts the substituted path exists on disk while the literal-template path does not — fails on main, passes with this change.
  • cargo fmt
  • cargo test — 16 passed.
  • Verified end-to-end against a real ADBC driver using a profile whose uri contains {{ env_var(...) }} for the auth token.

Fixes #19

The ADBC connection-profile spec specifies that profile option values containing
`{{ env_var(NAME) }}` are expanded against the process environment when the
profile is loaded. `adbc_driver_manager` performs this expansion when callers
go through its `DriverLocator::Profile` path (via `process_profile_value`),
but databow's `initialize_profile_connection` loads the profile through
`FilesystemProfileProvider` directly and forwards the resulting `OptionValue`s
to the driver without applying the substitution. Profiles that reference env
vars therefore fail at connect time because the literal template string reaches
the driver.

Apply `process_profile_value` to every `OptionValue::String` returned by the
profile, matching the driver manager's own behavior. Add a regression test
that asserts the expanded value reaches the driver (the test points DuckDB at
a database file whose name comes from an env var and verifies the substituted
path exists on disk while the literal-template path does not).

Fixes columnar-tech#19
@esadek esadek merged commit 974d474 into columnar-tech:main Jul 8, 2026
17 checks passed
@esadek

esadek commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@theiotidiot Released in 0.1.2 on PyPI and crates.io.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profile option values are not expanded with env_var substitution

2 participants