To merge common parameters with environment-specific parameters in Databricks Asset Bundle (DAB) YAMLs, the most effective approach is to adopt modular YAML files, leveraging the include
directive and hierarchical overrides within the targets
mapping. This supports both efficient parameter reuse and scalable environment management.
Merging Parameters: Structure and Inclusion
-
Define common parameters (or variables) in a separate YAML file, such as variables/common.yml
, which contains settings shared across all environments.
-
Environment-specific variables should each reside in dedicated files, like variables/<workflow>.dev.yml
, variables/<workflow>.test.yml
, variables/<workflow>.prod.yml
, etc.
-
In your main databricks.yml
, use the include
directive to bring in the common.yml
and the specific environment file required for deployment. Update the included environment-specific file either manually or via automation (e.g., with a CI/CD script).
Here's some example code (text)
include:
- resources/**/*.yml
- variables/common.yml
- variables/<workflow>.dev.yml # Switch to test.yml, prod.yml, etc. as needed