A collection of Databricks Asset Bundle (DAB) templates for streamlining development of Databricks projects with automated deployment via Azure Pipelines.
This repository contains the following templates:
- dab-project: Base template for creating a new Databricks Asset Bundle project with Azure Pipelines integration
- dab-target: Template for adding new deployment targets (environments) to your project
- dab-job: Template for adding new Databricks jobs to your project
- Databricks CLI installed and configured
Initialize a new Databricks Asset Bundle project with our template.
Replace PROFILE_NAME with the Databricks profile name you will use for developing and testing your project:
databricks bundle init https://github.com/bulv1ne/dab-template --template-dir dab-project --profile PROFILE_NAMEThis will create a new project with the following structure:
- Azure Pipelines configuration for CI/CD
- Databricks bundle configuration
- Directory structure for jobs and targets
After creating your project, you should:
-
Install and configure pre-commit hooks as follows:
pip install --user pre-commit # or pipx install pre-commit pre-commit install -
Update the
targets/dev.ymlfile:- Verify the catalog
- Update the storage_root (see your Databricks workspace or cloud storage configuration)
Add a new Databricks job to your project:
databricks bundle init https://github.com/bulv1ne/dab-template --template-dir dab-job --profile PROFILE_NAMEAfter creating a job, configure it by:
- Edit the Python file
jobs/[job_name]/<file_name>.pyto implement your job logic. - Update the YAML configuration file
jobs/[job_name]/job.ymlwith the appropriate settings.
Add a new deployment target (environment) to your project as follows.
Replace TARGET_PROFILE_NAME with the Databricks profile name for the target environment (e.g., production, staging):
databricks bundle init https://github.com/bulv1ne/dab-template --template-dir dab-target --profile TARGET_PROFILE_NAMEFor each target added:
-
Update the
targets/prod_<environment>.ymlfile:- Verify the catalog
- Update the storage_root (see your Databricks workspace or cloud storage configuration)
- Update the slack_channel_email
- Set the service_principal_name
-
Add the target to the
azure-pipelines.ymlfile in the strategy matrix:strategy: matrix: # Add your targets here prod_<environment>: target: 'prod_<environment>' # Your newly added target
The templates include Azure Pipelines configurations that will:
- Validate your Databricks Asset Bundle
- Deploy your bundle to the specified targets when merging to the main branch
# Validate bundle configuration for errors, warnings, and recommendations.
# Validation checks the configuration syntax and schema, permissions, etc.
databricks bundle validate -t <target>
# Summarize resources deployed by this bundle with their workspace URLs.
# Useful after deployment to see what was created and where to find it.
databricks bundle summary -t <target>
# Deploy your bundle
databricks bundle deploy -t <target>We welcome contributions! Please open an issue or submit a pull request if you have suggestions or improvements.
For more information about Databricks Asset Bundle templates, see the official documentation: https://docs.databricks.com/aws/en/dev-tools/bundles/templates