Databricks app with parameters from databricks asset bundle

Naga05
New Contributor III

Hellooo

I tried out setting up a Databricks App using asset bundle, where i was able to successfully parameterize the sql warehouse id which was specified on specific targets. However i was unable to get values of other variables from the targets, the variable does not get resolved on the app.

databricks.yml:

bundle:
  name: etl_deploy

include:
  - common/*.yml

targets:
  dev:
    mode: development
    default: true
    workspace:
      host: https://11111111.4.gcp.databricks.com/
    variables:
      short_env_name: dev
      permission_level: CAN_MANAGE
      schedule_state: PAUSED
      db_connection: salesforce_dev
  qal:
    mode: production
    default: true
    workspace:
      host: https://1234567.1.gcp.databricks.com/
    variables:
      short_env_name: qal
      permission_level: CAN_RUN
      schedule_state: UNPAUSED
      db_connection: salesforce_uat

Streamlit app's app.yml file:

command:
  - "streamlit"
  - "run"
  - "app.py"

env:
  - name: SQL_WAREHOUSE_ID
    valueFrom: sql-warehouse
  - name: DB_CONNECTION
    value: ${var.db_connection}

My common_variables.yml file:

variables:
  # Database connections settings
  db_connection:
    default: "unknown"

 On my app.py file, i tried to access the variable as below:

connection = os.getenv("DB_CONNECTION")

 when i deploy the app, i can see from the Environment tab of the App as unresolved value:

"DB_CONNECTION=${var.db_connection}",

What would be the way to catch the variable values from the Bundle targets into the Databricks App?