---
title: Bundle configuration examples
description: Find bundle configuration examples for common bundle use cases and features, including jobs and pipelines running on serverless.
canonical_url: https://docs.databricks.com/aws/en/dev-tools/bundles/examples
---

# Bundle configuration examples

This article provides example configuration for Declarative Automation Bundles (formerly known as Databricks Asset Bundles) features and common bundle use cases.

Complete bundle examples, outlined in the following table, are available in the [bundle-examples GitHub repository](https://github.com/databricks/bundle-examples/tree/main/knowledge_base):

| Bundle name                                                                                                                                  | Description                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [app\_with\_database](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/app_with_database)                              | A bundle with a Databricks app backed by an OLTP Postgres database                                                                                                                                |
| [app\_with\_genie\_space](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/app_with_genie_space)                       | A bundle that defines a Databricks app that uses a Genie agent.                                                                                                                                   |
| [dashboard\_nyc\_taxi](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/dashboard_nyc_taxi)                            | A bundle with an AI/BI dashboard and a job that captures a snapshot of the dashboard and emails it to a subscriber                                                                                |
| [database\_with\_catalog](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/database_with_catalog)                      | A bundle that defines an OLTP database instance and a database catalog                                                                                                                            |
| [databricks\_app](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/databricks_app)                                     | A bundle that defines a Databricks App                                                                                                                                                            |
| [development\_cluster](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/development_cluster)                           | A bundle that defines and uses a development (all-purpose) cluster                                                                                                                                |
| [genie\_space\_nyc\_taxi](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/genie_space_nyc_taxi)                       | A bundle that defines a Genie agent that answers questions about the `samples.nyctaxi.trips` table.                                                                                               |
| [job\_backfill\_data](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_backfill_data)                              | A bundle that defines a job that runs a SQL task with a date parameter for backfilling data.                                                                                                      |
| [job\_conditional\_execution](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_conditional_execution)              | A bundle that defines a job that uses conditional task execution based on data quality checks.                                                                                                    |
| [job\_file\_arrival](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_file_arrival)                                | A bundle that defines a job that uses file arrival triggers to automatically process new files when they arrive in a Unity Catalog volume.                                                        |
| [job\_read\_secret](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_read_secret)                                  | A bundle that defines a secret scope and a job with a task that reads from it                                                                                                                     |
| [job\_table\_update\_trigger](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_table_update_trigger)               | A bundle that demonstrates a workflow when producers write to Unity Catalog tables, consumers can trigger on table updates instead of time‑based schedules.                                       |
| [job\_with\_multiple\_wheels](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_with_multiple_wheels)               | A bundle that defines and uses a job with multiple wheel dependencies                                                                                                                             |
| [job\_with\_run\_job\_tasks](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_with_run_job_tasks)                  | A bundle with multiple jobs with run job tasks                                                                                                                                                    |
| [job\_with\_sql\_notebook](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/job_with_sql_notebook)                     | A bundle with a job that uses a SQL notebook task                                                                                                                                                 |
| [metric\_view](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/metric_view)                                           | A bundle that create a Unity Catalog metric view. Once registered, the metric view becomes available to analysts and BI tools across your workspace, queryable with the `MEASURE()` SQL function. |
| [pipeline\_with\_schema](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/pipeline_with_schema)                        | A bundle that defines a Unity Catalog schema and a pipeline that uses it                                                                                                                          |
| [private\_wheel\_packages](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/private_wheel_packages)                    | A bundle that uses a private wheel package from a job                                                                                                                                             |
| [python\_wheel\_poetry](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/python_wheel_poetry)                          | A bundle that builds a `whl` with Poetry                                                                                                                                                          |
| [serverless\_job](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/serverless_job)                                     | A bundle that uses serverless compute to run a job                                                                                                                                                |
| [share\_files\_across\_bundles](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/share_files_across_bundles)           | A bundle that includes files located outside the bundle root directory.                                                                                                                           |
| [spark\_jar\_task](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/spark_jar_task)                                    | A bundle that defines and uses a Spark JAR task                                                                                                                                                   |
| [target\_includes](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/target_includes)                                   | A bundle that demonstrates the concept of using target\_includes (or similar include mechanisms) to organize job configurations across different environments without duplication.                |
| [vector\_search\_product\_discovery](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/vector_search_product_discovery) | A bundle that demonstrates semantic product search using [Databricks AI Search](https://docs.databricks.com/aws/en/ai-search/ai-search.md).                                                       |
| [write\_from\_job\_to\_volume](https://github.com/databricks/bundle-examples/tree/main/knowledge_base/write_from_job_to_volume)              | A bundle that writes a file to a Unity Catalog volume                                                                                                                                             |

## Bundle scenarios

This section contains configuration examples that demonstrate using top-level bundle mappings. See [Configuration reference](https://docs.databricks.com/aws/en/dev-tools/bundles/reference.md).

### <a id="jar-upload" />Bundle that uploads a JAR file to Unity Catalog

You can specify Unity Catalog volumes as an artifact path so that all artifacts, such as JAR files and wheel files, are uploaded to Unity Catalog volumes. The following example bundle builds and uploads a JAR file to Unity Catalog. For information on the `artifact_path` mapping, see [workspace.artifact\_path](https://docs.databricks.com/aws/en/dev-tools/bundles/reference.md#workspace-artifact_path). For information on `artifacts`, see [artifacts](https://docs.databricks.com/aws/en/dev-tools/bundles/reference.md#artifacts).

```yaml
bundle:
  name: jar-bundle

workspace:
  host: https://myworkspace.cloud.databricks.com
  artifact_path: /Volumes/main/default/my_volume

artifacts:
  my_java_code:
    path: ./sample-java
    build: 'javac PrintArgs.java && jar cvfm PrintArgs.jar META-INF/MANIFEST.MF PrintArgs.class'
    files:
      - source: ./sample-java/PrintArgs.jar

resources:
  jobs:
    jar_job:
      name: 'Spark Jar Job'
      tasks:
        - task_key: SparkJarTask
          new_cluster:
            num_workers: 1
            spark_version: '14.3.x-scala2.12'
            node_type_id: 'i3.xlarge'
          spark_jar_task:
            main_class_name: PrintArgs
          libraries:
            - jar: ./sample-java/PrintArgs.jar
```

## <a id="dashboard" />Dashboard configuration

This section contains dashboard configuration examples. For dashboard configuration details, see [dashboard](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#dashboard).

### <a id="dashboard-dataset" />Dashboard catalog and schema parameterization

You can define a single catalog and schema for the datasets within a dashboard when deploying it with Declarative Automation Bundles using the `dataset_catalog` and `dataset_schema` fields of the [dashboard resource](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#dashboard).

> [!NOTE]
>
> To parameterize specific table references inside of SQL, you can use the `current_catalog()` function.

The following example bundle configuration defines variables to set the catalog and schema values for the `dev` and `prod` targets. It assumes that there is a file [`nyc_taxi_trip_analysis.lvdash.json`](https://github.com/databricks/bundle-examples/blob/main/knowledge_base/dashboard_nyc_taxi/src/nyc_taxi_trip_analysis.lvdash.json) in the `src` folder of the bundle.

```yaml
bundle:
  name: dashboard-bundle

variables:
  warehouse_id:
    description: Warehouse
    default: baf79a9e4ze90f02
  catalog_name:
    description: 'Catalog name'
    default: test_catalog
  schema_name:
    description: 'Schema name'
    default: ${workspace.current_user.short_name}

resources:
  dashboards:
    nyc_taxi_trip_analysis:
      display_name: 'NYC Taxi Trip Analysis'
      file_path: src/nyc_taxi_trip_analysis.lvdash.json
      warehouse_id: ${var.warehouse_id}
      dataset_catalog: ${var.catalog}
      dataset_schema: ${var.schema}

targets:
  dev:
    mode: development
    default: true
    workspace:
      host: https://myworkspace.cloud.databricks.com
    variables:
      catalog: dev_catalog
      schema: ${workspace.current_user.short_name}

  prod:
    mode: production
    workspace:
      host: https://myworkspace.cloud.databricks.com
      root_path: /Workspace/Users/someone@example.com/.bundle/${bundle.name}/${bundle.target}
    variables:
      catalog_name: prod_catalog
      schema_name: prod_schema
    permissions:
      - user_name: someone@example.com
        level: CAN_MANAGE
```

## <a id="job" />Job configuration

This section contains job configuration examples. For job configuration details, see [job](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#job).

### <a id="job-serverless" />Job that uses serverless compute

Declarative Automation Bundles support jobs that run on [serverless compute](https://docs.databricks.com/aws/en/compute/serverless/index.md). See [Run your Lakeflow Jobs with serverless compute for workflows](https://docs.databricks.com/aws/en/jobs/run-serverless-jobs.md). To configure this, you can either omit the `clusters` setting for a job with a notebook task, or you can specify an environment as shown in the examples below. For Python script, Python wheel, and dbt tasks, `environment_key` is required for serverless compute. See [environment\_key](https://docs.databricks.com/api/workspace/jobs/create#tasks-environment_key).

```yaml
# A serverless job (no cluster definition)
resources:
  jobs:
    serverless_job_no_cluster:
      name: serverless_job_no_cluster

      email_notifications:
        on_failure:
          - someone@example.com

      tasks:
        - task_key: notebook_task
          notebook_task:
            notebook_path: ../src/notebook.ipynb
```

```yaml
# A serverless job (environment spec)
resources:
  jobs:
    serverless_job_environment:
      name: serverless_job_environment

      tasks:
        - task_key: task
          spark_python_task:
            python_file: ../src/main.py

          # The key that references an environment spec in a job.
          # https://docs.databricks.com/api/workspace/jobs/create#tasks-environment_key
          environment_key: default

      # A list of task execution environment specifications that can be referenced by tasks of this job.
      environments:
        - environment_key: default

          # Full documentation of this spec can be found at:
          # https://docs.databricks.com/api/workspace/jobs/create#environments-spec
          spec:
            environment_version: '2'
            dependencies:
              - my-library
```

### Job with multiple wheel files

The following example configurations defines a bundle that contains a job with multiple `*.whl` files.

```yaml
# job.yml
resources:
  jobs:
    example_job:
      name: 'Example with multiple wheels'
      tasks:
        - task_key: task

          spark_python_task:
            python_file: ../src/call_wheel.py

          libraries:
            - whl: ../my_custom_wheel1/dist/*.whl
            - whl: ../my_custom_wheel2/dist/*.whl

          new_cluster:
            node_type_id: i3.xlarge
            num_workers: 0
            spark_version: 14.3.x-scala2.12
            spark_conf:
              'spark.databricks.cluster.profile': 'singleNode'
              'spark.master': 'local[*, 4]'
            custom_tags:
              'ResourceClass': 'SingleNode'
```

```yaml
# databricks.yml
bundle:
  name: job_with_multiple_wheels

include:
  - ./resources/job.yml

workspace:
  host: https://myworkspace.cloud.databricks.com

artifacts:
  my_custom_wheel1:
    type: whl
    build: poetry build
    path: ./my_custom_wheel1

  my_custom_wheel2:
    type: whl
    build: poetry build
    path: ./my_custom_wheel2

targets:
  dev:
    default: true
    mode: development
```

### <a id="job-parameters" />Job with parameters

The following example configuration defines a job with parameters. For more information about parameterizing jobs, see [Parameterize jobs](https://docs.databricks.com/aws/en/jobs/parameters.md).

```yaml
resources:
  jobs:
    job_with_parameters:
      name: job_with_parameters

      tasks:
        - task_key: task_a
          spark_python_task:
            python_file: ../src/file.py
            parameters:
              - '--param1={{ job.parameters.param1 }}'
              - '--param2={{ job.parameters.param2 }}'

          new_cluster:
            node_type_id: i3.xlarge
            num_workers: 1
            spark_version: 14.3.x-scala2.12

      parameters:
        - name: param1
          default: value1
        - name: param2
          default: value1
```

These parameters can be set at runtime by [passing job parameters](https://docs.databricks.com/aws/en/dev-tools/cli/bundle-commands.md#job-parameters) to `bundle run`, for example:

```bash
databricks bundle run -- --param1=value2 --param2=value2
```

### Job that uses a requirements.txt file

The following example configuration defines a job that uses a requirements.txt file.

```yaml
resources:
  jobs:
    job_with_requirements_txt:
      name: 'Example job that uses a requirements.txt file'
      tasks:
        - task_key: task
          job_cluster_key: default
          spark_python_task:
            python_file: ../src/main.py
          libraries:
            - requirements: /Workspace/${workspace.file_path}/requirements.txt
```

### Job on a schedule

The following examples show configuration for jobs that run on a schedule. For information about job schedules and triggers, see [Automate jobs with schedules and triggers](https://docs.databricks.com/aws/en/jobs/triggers.md).

This configuration defines a job that runs daily at a specified time:

```yaml
resources:
  jobs:
    my-notebook-job:
      name: my-notebook-job
      tasks:
        - task_key: my-notebook-task
          notebook_task:
            notebook_path: ./my-notebook.ipynb
      schedule:
        quartz_cron_expression: '0 0 8 * * ?' # daily at 8am
        timezone_id: UTC
        pause_status: UNPAUSED
```

In this configuration, the job runs one week after the job was last run:

```yaml
resources:
  jobs:
    my-notebook-job:
      name: my-notebook-job
      tasks:
        - task_key: my-notebook-task
          notebook_task:
            notebook_path: ./my-notebook.ipynb
      trigger:
        pause_status: UNPAUSED
        periodic:
          interval: 1
          unit: WEEKS
```

## <a id="pipeline" />Pipeline configuration

This section contains pipeline configuration examples. For pipeline configuration information, see [pipeline](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#pipeline).

### Pipeline that uses serverless compute

Declarative Automation Bundles support pipelines that run on [serverless compute](https://docs.databricks.com/aws/en/compute/serverless/index.md). To configure this, set the pipeline `serverless` setting to `true`. The following example configuration defines a pipeline that runs on serverless compute with dependencies installed, and a job that triggers a refresh of the pipeline every hour.

```yaml
# A pipeline that runs on serverless compute
resources:
  pipelines:
    my_pipeline:
      name: my_pipeline
      target: ${bundle.environment}
      serverless: true
      environment:
        dependencies:
          - 'dist/*.whl'
      catalog: users
      libraries:
        - notebook:
            path: ../src/my_pipeline.ipynb

      configuration:
        bundle.sourcePath: /Workspace/${workspace.file_path}/src
```

```yaml
# This defines a job to refresh a pipeline that is triggered every hour
resources:
  jobs:
    my_job:
      name: my_job

      # Run this job once an hour.
      trigger:
        periodic:
          interval: 1
          unit: HOURS

      email_notifications:
        on_failure:
          - someone@example.com

      tasks:
        - task_key: refresh_pipeline
          pipeline_task:
            pipeline_id: ${resources.pipelines.my_pipeline.id}
```

### <a id="pipeline-continuous" />Pipeline that runs continuously

To run a pipeline continuously, add it as a task in a [continuous job](https://docs.databricks.com/aws/en/jobs/continuous.md). The following example configuration defines a continuous job that runs the `my_pipeline` pipeline from the previous example and sets a [maintenance window](https://docs.databricks.com/aws/en/ldp/maintenance-windows.md), so platform-initiated updates and restarts start in a one-hour window that begins at 2 AM Eastern Time on Tuesdays. The example also sets `databricks_cli_version` to the minimum version that supports `maintenance_window`. See [Configure a maintenance window with Declarative Automation Bundles](https://docs.databricks.com/aws/en/ldp/maintenance-windows.md#schedule-dabs).

```yaml
# databricks.yml
bundle:
  name: continuous_pipeline_bundle
  databricks_cli_version: '>= 1.16.0'
```

```yaml
# This defines a job that runs a pipeline continuously
resources:
  jobs:
    my_continuous_job:
      name: my_continuous_job

      continuous:
        pause_status: UNPAUSED
        maintenance_window:
          start_hour: 2
          day_of_week: TUESDAY
          timezone_id: America/New_York

      email_notifications:
        on_failure:
          - someone@example.com

      tasks:
        - task_key: refresh_pipeline
          pipeline_task:
            pipeline_id: ${resources.pipelines.my_pipeline.id}
```
