09-28-2025 07:41 PM
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_uatStreamlit 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?
09-29-2025 01:02 AM
Hi @Naga05
try this:
09-29-2025 01:42 AM - edited 09-29-2025 01:44 AM
resources:
apps:
query-data:
name: query-data
description: 'To get sales data from the delta table'
source_code_path: ../app
resources:
- name: "sql-warehouse"
sql_warehouse:
id: ${var.sql_warehouse_id}
permission: "CAN_MANAGE"
permissions:
- level: CAN_MANAGE
group_name: ${var.access_group}
09-29-2025 06:55 AM - edited 09-29-2025 06:56 AM
Hi @Naga05 how about adding this variable under bundle’s resources file common_variables.yml?
09-29-2025 10:27 AM
Found that this is an implementation in progress on the Databricks CLI. https://github.com/databricks/cli/issues/3679
Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!
Sign Up Now