bundle command group

Note

This information applies to Databricks CLI versions 0.205 and above, which are in Public Preview. To find your version of the Databricks CLI, run databricks -v.

The bundle command group within the Databricks CLI enables you to programmatically validate, deploy, and run Databricks workflows such as Databricks jobs, Delta Live Tables pipelines, and MLOps stacks. See What are Databricks asset bundles?.

Important

Before you use the Databricks CLI, be sure to set up the Databricks CLI and set up authentication for the Databricks CLI.

You run bundle commands by appending them to databricks bundle. To display help for the bundle command, run databricks bundle -h.

Create a bundle from a project template

To create a Databricks asset bundle by using the default Databricks asset bundle template for Python, run the bundle init command as follows, and then answer the on-screen prompts:

databricks bundle init

To create a Databricks asset bundle by using a non-default Databricks asset bundle template, run the bundle init command as follows:

databricks bundle init <project-template-local-path-or-url> \
--project-dir="</local/path/to/project/template/output>"

See also:

Generate the bundle configuration schema

To display the Databricks asset bundle configuration schema, run the bundle schema command, as follows:

databricks bundle schema

To generate the Databricks asset bundle configuration schema as a JSON file, run the bundle schema command and redirect the output to a JSON file. For example, you can generate a file named bundle_config_schema.json within the current directory, as follows:

databricks bundle schema > bundle_config_schema.json

Validate a bundle

To validate that your bundle configuration files are syntactically correct, run the bundle validate command from the same directory as the bundle configuration files, as follows:

databricks bundle validate

Sync a bundle’s tree to a workspace

Use the bundle sync command to do one-way synchronization of a bundle’s file changes within a local filesystem directory, to a directory within a remote Databricks workspace.

Note

bundle sync commands cannot synchronize file changes from a directory within a remote Databricks workspace, back to a directory within a local filesystem.

databricks bundle sync commands work in the same way as databricks bundle commands and are provided as a productivity convenience. For command usage information, see sync command group.

Deploy a bundle

To deploy any specified local artifacts to the remote workspace, run the bundle deploy command from the same directory as the bundle configuration files (which is also known as the bundle root). If no command options are specified, the default environment as declared within the bundle configuration files is used, as follows:

databricks bundle deploy

Tip

You can run databricks bundle commands outside of the bundle root. If so, you can specify the bundle root path by setting the BUNDLE_ROOT environment variable. If this environment variable is not set, databricks bundle commands attempt to find the bundle root by searching within the current working directory.

To deploy the artifacts within the context of a specific environment, specify the -e (or --environment) option along with the environment’s name as declared within the bundle configuration files. For example, for an environment declared with the name development, run the following command:

databricks bundle deploy -e development

Run a bundle

To run a specific job or pipeline, run the bundle run command from the same directory as the bundle configuration files. You must specify the job or pipeline declared within the bundle configuration files. If the -e (or --environment) option is not specified, the default environment as declared within the bundle configuration files is used. For example, to run a job named hello_job within the context of the default environment, run the following command:

databricks bundle run hello_job

To run a job named hello_job within the context of an environment declared with the name development, run the following command:

databricks bundle run -e development hello_job

Destroy a bundle

To delete jobs, pipelines, and artifacts that were previously deployed, run the bundle destroy command from the same directory as the bundle configuration files. The following command deletes all previously-deployed jobs, pipelines, and artifacts that are defined in the bundle configuration files:

databricks bundle destroy

By default, you are prompted to confirm permanent deletion of the previously-deployed jobs, pipelines, and artifacts. To skip these prompts and perform automatic permanent deletion, add the --auto-approve option to the bundle destroy command.