Databricks Asset Bundles

Asset Bundles let you describe a Databricks project as code and deploy it with one command. A bundle holds notebooks, jobs, pipelines, and settings in a single folder that lives in version control. Teams move the same project from development to production with fewer manual clicks and fewer surprises.

The Blueprint Analogy

A builder who constructs a house from verbal instructions produces a different house each time. A builder who works from a blueprint produces the same house on every site. A bundle serves as the blueprint for your Databricks project. The blueprint says which jobs exist, which notebooks they run, and which settings apply in each environment.

CLICK-BASED VS BUNDLE-BASED DEPLOYMENT
──────────────────────────────────────────────────────────
CLICK-BASED:
  Developer builds job in dev by hand
  Developer rebuilds the same job in prod by hand
  Small differences creep in and break production

BUNDLE-BASED:
  One bundle folder in Git
  databricks bundle deploy -t dev    → development copy
  databricks bundle deploy -t prod   → production copy
  Same definition, same result

Folder Structure

sales_project/
├── databricks.yml          ← main bundle file
├── resources/
│   └── daily_job.yml       ← job definition
├── src/
│   ├── load_orders.py      ← notebook or script
│   └── build_report.py
└── tests/
    └── test_report.py

The Main Configuration File

The databricks.yml file names the bundle, lists the target environments, and points to resource files. YAML uses indentation to show structure, so keep spacing consistent.

bundle:
  name: sales_project

include:
  - resources/*.yml

targets:
  dev:
    mode: development
    default: true
    workspace:
      host: https://YOUR-DEV-WORKSPACE-HOST

  prod:
    mode: production
    workspace:
      host: https://YOUR-PROD-WORKSPACE-HOST

Targets

A target is an environment such as dev, test, or prod. Each target can point to a different workspace and use different settings. Development mode adds a user prefix to resource names, so teammates do not overwrite each other's work.

Define a Job as a Resource

resources:
  jobs:
    daily_sales_job:
      name: daily-sales-job
      schedule:
        quartz_cron_expression: "0 0 6 * * ?"
        timezone_id: "Asia/Kolkata"
      tasks:
        - task_key: load_orders
          notebook_task:
            notebook_path: ../src/load_orders.py
        - task_key: build_report
          depends_on:
            - task_key: load_orders
          notebook_task:
            notebook_path: ../src/build_report.py

The job above runs two tasks every morning at six. The second task waits for the first task to finish.

Core Commands

CommandPurpose
databricks bundle initCreate a new bundle from a template
databricks bundle validateCheck the configuration for errors
databricks bundle deploy -t devUpload files and create resources in the dev target
databricks bundle run daily_sales_jobStart a job from the command line
databricks bundle destroyRemove the deployed resources

A Typical Developer Flow

DEVELOPER WORKFLOW
──────────────────────────────────────────────────────────
Edit code locally
      │
databricks bundle validate     (catch mistakes early)
      │
databricks bundle deploy -t dev
      │
databricks bundle run daily_sales_job
      │
Review results ──► Commit to Git ──► Pull request

Variables and Environment Differences

Dev and production rarely share every value. A development job might write to a test catalog, and the production job writes to the live catalog. Bundle variables hold those values in one place, and each target supplies its own setting. The job file stays identical, which removes a common source of mistakes.

variables:
  catalog_name:
    description: Catalog that receives the output tables
    default: dev_catalog

targets:
  prod:
    variables:
      catalog_name: main

A task reads the variable through a parameter, so the same notebook writes to the correct catalog in every environment.

Automating Deployment with CI/CD

CI/CD means continuous integration and continuous delivery. A CI/CD system, such as GitHub Actions or Azure DevOps, watches your repository. A pull request triggers tests and a validation step. A merge to the main branch deploys the bundle to production.

CI/CD PIPELINE
──────────────────────────────────────────────────────────
Pull request ──► run tests ──► bundle validate ──► approval
                                                      │
Merge to main ──► bundle deploy -t prod ◄─────────────┘

Use a service principal for automated deployments. The service principal needs permission only for the target workspace, which limits risk.

Example: Daily Sales Project

A data team builds a daily sales pipeline. One developer works in the dev target and tests changes freely. A teammate reviews the pull request and checks the bundle validation. The merge deploys the same job definition to production, and the schedule starts the next morning. A later change to the schedule takes one edit in one file.

DAILY SALES PROJECT TIMELINE
──────────────────────────────────────────────────────────
Monday    Developer edits job file and deploys to dev
Tuesday   Reviewer approves the pull request
Tuesday   Pipeline deploys to prod automatically
Wednesday Job runs on the new schedule

Good Habits

  • Keep the bundle in Git and review every change.
  • Avoid hard-coded workspace addresses and secrets in shared files.
  • Use variables for values that differ between targets, such as catalog names.
  • Test notebooks and functions before you deploy to production.

Key Points

  • A bundle describes jobs, pipelines, and code as files that live in Git.
  • The databricks.yml file defines the bundle name, resources, and targets.
  • Targets let one project deploy to dev, test, and production.
  • The validate, deploy, run, and destroy commands manage the full lifecycle.
  • CI/CD systems deploy bundles automatically after review.
  • Code-based deployment reduces manual errors and keeps environments consistent.