Skip to content

Profile option values are not expanded with env_var substitution #19

Description

@theiotidiot

Summary

When connecting via a profile (databow --profile NAME), option values containing the ADBC {{ env_var(NAME) }} substitution template are passed to the driver verbatim instead of being expanded from the process environment. As a result, profiles that rely on environment-variable substitution to inject credentials or URIs (per the ADBC connection-profile spec) fail to connect.

Reproduction

/tmp/repro.toml:

profile_version = 1
driver = "databricks"

[Options]
uri = "databricks://token:{{ env_var(DATABRICKS_TOKEN) }}@host.cloud.databricks.com:443/sql/1.0/warehouses/abc123"
$ DATABRICKS_TOKEN=dapi... databow --profile /tmp/repro.toml --query "SELECT 1"
Failed to create connection: Unknown: [Databricks] databricks: request error: invalid DSN: invalid format: parse "https://token:{{ env_var(DATABRICKS_TOKEN) }}@host.cloud.databricks.com:443/...": net/url: invalid userinfo (sqlstate: [0, 0, 0, 0, 0], vendor_code: -2147483648)

The literal {{ env_var(DATABRICKS_TOKEN) }} template reaches the driver instead of the token value.

Root Cause

adbc_driver_manager only applies env-var substitution along the DriverLocator::Profile code path in ManagedDriver::new_database_with_opts (see lib.rs:593-604 in adbc_driver_manager 0.23.0, which calls process_profile_value for every OptionValue::String).

databow::database::initialize_profile_connection bypasses that path: it loads the profile via FilesystemProfileProvider, collects options with profile.get_options(), and passes them straight to driver.new_database_with_opts(...) without ever calling process_profile_value. Substitution never runs.

Expected Behavior

Profile option values containing {{ env_var(NAME) }} should be expanded against the process environment before the options are handed to the driver — matching the ADBC spec and the behavior users get when going through the driver manager's own DriverLocator::Profile path.

Environment

  • databow 0.1.0
  • macOS arm64
  • adbc_driver_manager 0.23.0

Happy to send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions