---
title: Develop pipelines with Declarative Automation Bundles
description: Complete a hands-on tutorial that demonstrates how to use Declarative Automation Bundles to work with Lakeflow pipelines.
canonical_url: https://docs.databricks.com/aws/en/dev-tools/bundles/pipelines-tutorial
---

# Develop pipelines with Declarative Automation Bundles

Declarative Automation Bundles (formerly known as Databricks Asset Bundles) enable you to programmatically validate, deploy, and run Databricks resources such as Lakeflow pipelines. See [What are Declarative Automation Bundles?](https://docs.databricks.com/aws/en/dev-tools/bundles/index.md).

This page describes how to create a bundle to programmatically manage a pipeline. See [Spark Declarative Pipelines on Lakeflow](https://docs.databricks.com/aws/en/ldp/index.md). The bundle is created using the Databricks CLI [`pipelines init` command](https://docs.databricks.com/aws/en/dev-tools/cli/reference/pipelines-commands.md#databricks-pipelines-init), which defines an ETL pipeline and job to run it. You then validate, deploy, and run the deployed pipeline in your Databricks workspace on serverless compute.

> [!TIP]
>
> If you have existing pipelines that were created using the Databricks user interface or API that you want to move to bundles, you must define them in a bundle's configuration files. Databricks recommends that you first create a bundle using the steps below, then add configuration and other sources to the bundle. See [Retrieve an existing pipeline definition using the UI](https://docs.databricks.com/aws/en/dev-tools/bundles/migrate-resources.md#existing-pipeline).

## Requirements

* Databricks CLI version 0.283.0 or above. To check your installed version of the Databricks CLI, run the command `databricks -v`. To install the Databricks CLI, see [Install or update the Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/install.md).
* [uv](https://docs.astral.sh/uv/getting-started/installation/) is required to run tests and to install dependencies for this project from an IDE.
* The remote workspace must have workspace files enabled. See [What are workspace files?](https://docs.databricks.com/aws/en/files/workspace.md).
* An existing catalog for tables in the pipeline. See [Create catalogs](https://docs.databricks.com/aws/en/catalogs/create-catalog.md).

### (Optional) Install a Python module to support local pipeline development

Databricks provides a Python module to assist your local development of Lakeflow pipelines code by providing syntax checking, autocomplete, and data type checking as you write code in your IDE.

The Python module for local development is available on PyPi. To install the module, see [Python stub for DLT](https://pypi.org/project/databricks-dlt/).

## Step 1: Set up authentication

First, set up authentication between the Databricks CLI on your development machine and your Databricks workspace. This page assumes that you want to use OAuth user-to-machine (U2M) authentication and a corresponding Databricks configuration profile named `DEFAULT` for authentication.

> [!NOTE]
>
> U2M authentication is appropriate for trying out these steps in real time. For fully automated workflows, Databricks recommends that you use OAuth machine-to-machine (M2M) authentication instead. See the M2M authentication setup instructions in [Authorize Databricks service principal access to Databricks with OAuth](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m.md).

1. Use the [Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/install.md) to initiate OAuth token management locally by running the following command for each target workspace.

   In the following command, replace `<workspace-url>` with your Databricks [workspace instance URL](https://docs.databricks.com/aws/en/workspace/workspace-details.md#workspace-url), for example `https://dbc-a1b2345c-d6e7.cloud.databricks.com`.

   ```bash
   databricks auth login --host <workspace-url>
   ```

2. The Databricks CLI prompts you to save the information that you entered as a Databricks [configuration profile](https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles.md). Press `Enter` to accept the suggested profile name, or enter the name of a new or existing profile. Any existing profile with the same name is overwritten with the information that you entered. You can use profiles to quickly switch your authentication context across multiple workspaces.

   To get a list of any existing profiles, in a separate terminal or command prompt, use the Databricks CLI to run the command `databricks auth profiles`. To view a specific profile's existing settings, run the command `databricks auth env --profile <profile-name>`.

3. In your web browser, complete the on-screen instructions to log in to your Databricks workspace.

4. To view a profile's current OAuth token value and the token's upcoming expiration timestamp, run one of the following commands:

   * `databricks auth token --host <workspace-url>`
   * `databricks auth token -p <profile-name>`
   * `databricks auth token --host <workspace-url> -p <profile-name>`

   If you have multiple profiles with the same `--host` value, you might need to specify the `--host` and `-p` options together to help the Databricks CLI find the correct matching OAuth token information.

## Step 2: Create the bundle

Initialize a bundle with a pipeline:

1. Use your terminal or command prompt to switch to a directory on your local development machine that will contain the template's generated bundle.

2. Use the Databricks CLI to run the `pipelines init` command:

   ```bash
   databricks pipelines init
   ```

3. For `Unique name for this project`, leave the default value of `my_pipeline_project`, or type a different value, and then press `Enter`. This determines the name of the root directory for this bundle. This root directory is created within your current working directory.

4. For `Initial catalog`, enter the name of an existing Unity Catalog catalog.

5. For `Use a personal schema for each user working on this project?`, select `yes`.

6. For `Initial language for this project`, select `python`.

## Step 3: Explore the bundle

To view the files that the template generated, switch to the root directory of your newly created bundle. The following structure is created by default:

```
my_pipeline_project
├── databricks.yml
├── pyproject.toml
├── README.md
├── resources
│   ├── my_pipeline_project_etl.pipeline.yml
│   └── sample_job.job.yml
└── src
    └── my_pipeline_project_etl
        ├── explorations
        │   └── sample_exploration.ipynb
        ├── README.md
        └── transformations
            ├── sample_trips_my_pipeline_project.py
            └── sample_zones_my_pipeline_project.py
```

Files of particular interest include the following:

* `databricks.yml`: This file specifies the bundle's programmatic name, includes references to the bundle's files, defines catalog and schema variables, and specifies settings for target workspaces.

* `resources/sample_job.job.yml` and `resources/<project-name>_etl_pipeline.yml`: These files define the job that contains a pipeline refresh task, and the pipeline's settings. For information about pipeline settings, see [pipeline](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#pipelines).

* `src/`: This folder contains the sample pipeline's source files, explorations, and transformations.

  > [!TIP]
  >
  > If you add tests, use `pytest` to run them locally:
  >
  > ```bash
  > uv run pytest
  > ```

* `README.md`: This file contains additional information about getting started and using this bundle template.

## Step 4: Validate the bundle configuration

Now check whether the bundle configuration is valid.

1. From the root directory, use the Databricks CLI to run the `bundle validate` command:

   ```bash
   databricks bundle validate
   ```

2. If a summary of the bundle configuration is returned, then the validation succeeded. If any errors are returned, fix the errors, and then repeat this step.

## Step 5: Deploy the pipeline to the remote workspace

Next, deploy the bundle to your remote Databricks workspace and verify the pipeline in your workspace.

1. From the bundle root, use a Databricks CLI `deploy` command:

   ```bash
   databricks bundle deploy --target dev
   ```

   Or:

   ```bash
   databricks pipelines deploy --target dev
   ```

   > [!NOTE]
   >
   > The default template includes a job that runs the pipeline every day, but this is paused for the target `dev` deployment mode. See [Declarative Automation Bundles deployment modes](https://docs.databricks.com/aws/en/dev-tools/bundles/deployment-modes.md).

2. Confirm that the bundle was deployed:
   1. In your Databricks workspace's sidebar, click **Workspace**.
   2. Click into the **Users > `<your-username>` > `.bundle`** folder and find your bundle project.

3. Check whether your pipeline was created:
   1. In your Databricks workspace's sidebar, click **Jobs & Pipelines**.
   2. Optionally, select the **Pipelines** and **Owned by me** filters.
   3. Click **\[dev `<your-username>`] `<project-name>`\_etl**.

If you make any changes to your bundle after this step, you should repeat steps 4-5 to check whether your bundle configuration is still valid and then redeploy the project.

## Step 6: Run the deployed pipeline

Now trigger a run of the pipeline in your workspace from the command line.

1. From the root directory, use the Databricks CLI `pipelines run` command. If there is only one pipeline in the project, you do not need to specify a pipeline name.

   ```bash
   databricks pipelines run my_pipeline_project_etl --target dev
   ```

2. Copy the value of `Update URL` that appears in your terminal and paste this value into your web browser to open your Databricks workspace.

3. In your Databricks workspace, after the pipeline run completes successfully, click the materialized views to see the details of each view.

If you make any changes to your bundle after this step, you should repeat steps 4-6 to check whether your bundle configuration is still valid, redeploy the project, and run the redeployed project.

## Step 7: Output history and event logs

The information provided by the `pipelines history` and `pipelines logs` commands can help diagnose failures.

To retrieve past runs for the pipeline:

```bash
databricks pipelines history my_pipeline_project_etl
```

```Output
Updates Summary for pipeline my_pipeline_project_etl:
Update ID: a62293ec-8a63-43b7-8629-b218d56dac7c
   State: COMPLETED
   Cause: API_CALL
   Creation Time: 2026-01-29T23:16:14Z
   Full Refresh: false
   Validate Only: false
```

To output (in JSON) the events of the pipeline's most recent update:

```bash
databricks pipelines logs my_pipeline_project_etl
```

Use `jq` to filter the results. See [Filter JSON output with `jq`](https://docs.databricks.com/aws/en/dev-tools/cli/usage.md#jq).

## Step 8: Clean up

In this step, you delete the deployed bundle and the pipeline from your workspace.

1. From the root directory, use the Databricks CLI to run the `pipelines destroy` command:

   ```bash
   databricks pipelines destroy --target dev
   ```

2. When prompted to permanently destroy resources, the pipeline, and tables and views managed by the pipeline, type `y` and press `Enter`.

3. If you also want to delete the bundle from your development machine, you can now delete the local project directory.
