Databricks asset bundles and Dashboards - pass parameters depending on bundle target
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 07:08 AM
Hello everyone !
Since Databricks Asset Bundles can now be used to deploy dashboards, I'm wondering how to pass parameters so that the queries for the dev dashboard query the dev catalog, and the dashboard in stg query the stg catalog etc.
Is there any way to do this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 08:07 AM
Hi @erigaud,
Here’s how you can achieve this:
Define Variables in the Bundle Configuration: You can define custom variables in your databricks.yml file to hold the catalog names for different environments. For example:
variables:
catalog_name:
description: "The catalog name to use for the environment"
default: "dev_catalog"
Use Targets to Override Variables: You can specify different values for these variables in the targets section of your bundle configuration. This allows you to set different catalog names for different environments (e.g., dev, stg, prod).
targets:
dev:
default: true
variables:
catalog_name: "dev_catalog"
stg:
variables:
catalog_name: "stg_catalog"
prod:
variables:
catalog_name: "prod_catalog"
Reference Variables in SQL Queries: In your SQL queries within the dashboards, you can reference these variables to dynamically set the catalog name. For example
SELECT * FROM ${var.catalog_name}.schema_name.table_name
Please refer to: https://docs.databricks.com/en/dev-tools/bundles/settings.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 11:17 PM
Hello, I tried modifying my query in the lvdash.json file corresponding to my dashboard with
But it does not seem to be working and the variable is not replaced. I am doing something wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 05:39 AM
@erigaud : Did you find any solution for this. I'm also trying the same as yours. Please share if you have any solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2025 08:05 AM
Hi @selva092, I was able to contact someone from Databricks that explained that it is currently not supported, however it is in the backlog so hopefully it wiill come soon ! We just have to monitor the release notes for asset bundle until it's available

