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