Author bundles in the workspace
Databricks Asset Bundles in the workspace is in Public Preview.
Databricks Asset Bundles can be created and modified directly in the workspace.
For requirements for using bundles in the workspace, see Databricks Asset Bundles in the workspace requirements.
For more information about bundles, see What are Databricks Asset Bundles?.
Create a bundle
To create a bundle in the Databricks workspace:
-
Navigate to the Git folder where you want to create your bundle.
-
Click the Create button, then click Asset bundle. Alternatively, right click on the Git folder or its associated kebab in the workspace tree and click Create > Asset bundle:
-
In the Create an asset bundle dialog, give the asset bundle a name, such as totally-awesome-bundle. The bundle name can only contain letters, numbers, dashes, and underscores. Choose whether you want to create an empty bundle, a bundle that runs a sample Python notebook, or a bundle that runs SQL.
-
Click Create.
This creates an initial bundle in the Git folder, which includes the a .gitignore
Git configuration file and the required Databricks Asset Bundles databricks.yml
file. The databricks.yml
file contains the main configuration for the bundle. For details, see Databricks Asset Bundle configuration.
Any changes made to the files within the bundle can be synced with the remote repository associated with the Git folder. A Git folder can contain many bundles.
Add new files to a bundle
A bundle contains the databricks.yml
file that defines deployment and workspace configurations, source files, such as notebooks, Python files, and test files, and definitions and settings for Databricks resources, such as Lakeflow Jobs and Lakeflow Declarative Pipelines. Similar to any workspace folder, you can add new files to your bundle.
To open a new tab to the bundle view that lets you modify bundle files, navigate to the bundle folder in the workspace, then click Open in editor to the right of the bundle name.
Add source code files
To add new notebooks or other files to a bundle in the workspace UI, navigate to the bundle folder, then:
- Click Create in the upper right and choose one of the following file types to add to your bundle: Notebook, File, Query, Dashboard.
- Alternatively, click the kebab to the left of Share and import a file.
In order for the file to be part of the bundle deployment, after you add a file to your bundle folder you must add it to the databricks.yml
bundle configuration, or create a job or pipeline definition file that includes it. See Add an existing resource to a bundle.
Add a job definition
Bundles contain definitions for resources such as jobs and pipelines to include in a deployment. These definitions are specified in YAML or Python, and you can create and edit these configurations directly in the UI.
To create a bundle configuration file that defines a job:
-
Navigate to the bundle folder in the workspace where you want to define a new job.
-
To the right of the bundle name, click Open in editor to navigate to the bundle editor view.
-
Click the deployment icon for the bundle to switch to the Deployments panel.
-
Under Bundle resources, click Create, then Create new job definition.
-
Type a name for the job into the Job name field of the Create job definition dialog. Click Create.
-
Add YAML to the job definition file that was created. The folowing example YAML defines a job the runs a notebook:
YAMLresources:
jobs:
run_notebook:
name: run-notebook
queue:
enabled: true
tasks:
- task_key: my-notebook-task
notebook_task:
notebook_path: ../helloworld.ipynb
For details about defining a job in YAML, see job. For YAML syntax for other supported job task types, see Add tasks to jobs in Databricks Asset Bundles.
Add a pipeline definition
To create a bundle configuration file that defines a pipeline:
-
Navigate to the bundle folder in the workspace where you want to define a new pipeline.
-
To the right of the bundle name, click Open in editor to navigate to the bundle editor view.
-
Click the deployment icon for the bundle to switch to the Deployments panel.
-
Under Bundle resources, click Create, then Create new pipeline definition.
-
Type a name for the pipeline into the Pipeline name field of the Create pipeline definition dialog.
-
Click the folder icon to the right of the Source code field and select the code for this pipeline to run. Click Create.
For a pipeline with the name test_pipeline
that runs a notebook, the folowing YAML would be created in a file test_pipeline.pipeline.yml
:
resources:
pipelines:
test_pipeline:
name: test_pipeline
libraries:
- notebook:
path: ../helloworld.ipynb
serverless: true
catalog: main
target: test_pipeline_${bundle.environment}
For details about defining a pipeline in YAML, see pipeline.
Add an existing resource to a bundle
You can add existing resources such as pipelines, and also assets such as notebooks and other source files, to your bundle. However, you must define them in the bundle configuration to include them in your bundle deployment. The following example adds an existing pipeline to a bundle.
Assuming you have a pipeline named taxifilter
that runs the taxifilter.ipynb
notebook in your shared workspace:
-
Navigate to Workflows, then Pipelines.
-
Select the existing
taxifilter
pipeline. -
In the pipeline page, click the kebab to the left of the Development deployment mode button. Then click View settings YAML.
-
Click the copy icon to copy the bundle configuration for the pipeline.
-
Navigate to your bundle in Workspace.
-
Click the deployment icon for the bundle to switch to the Deployments panel.
-
Under Bundle resources, click Create, then Create new pipeline definition.
-
Type
taxifilter
into the Pipeline name field of the Create pipeline definition dialog. Click Create. -
Paste the configuration for the existing pipeline into the file. This example pipeline is defined to run the
taxifilter
notebook:YAMLresources:
pipelines:
taxifilter:
name: taxifilter
catalog: main
libraries:
- notebook:
path: /Workspace/Shared/taxifilter.ipynb
target: taxifilter_${bundle.environment}
You can now deploy the bundle, then run the pipeline resource through the UI.