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
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?.
bundle commands by appending them to
databricks bundle. To display help for the
bundle command, run
databricks bundle -h.
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> \
To display the Databricks Asset Bundle configuration schema, run the
bundle schema command, as follows:
databricks bundle schema
To output 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
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
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.
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.
You can use the
bundle generate command to generate resource configuration for a job or pipeline that already exists in your Databricks workspace. This command generates a *.yml file for the job or pipeline in the
resources folder of the bundle project and also downloads any notebooks referenced in the job or pipeline configuration. Currently only jobs with notebook tasks are supported by this command.
bundle generate command is provided as a convenience to autogenerate resource configuration. However, when this configuration is included in the bundle and deployed, it creates a new resource and does not update the existing resource unless
bundle deployment bind has first been used on the resource.
bundle generate command as follows:
databricks bundle generate [job|pipeline] --existing-[job|pipeline]-id [job-id|pipeline-id]
For example, the following command generates a new
hello_job.yml file in the
resources bundle project folder containing the YAML below, and downloads the
simple_notebook.py to the
src project folder.
databricks bundle generate job --existing-job-id 6565621249
# This is the contents of the resulting hello_job.yml file.
name: Hello Job
- task_key: run_notebook
bundle deployment bind command allows you to link bundle-defined jobs and pipelines to existing jobs or pipelines in the Databricks workspace so that they become managed by Databricks Asset Bundles. If you bind a resource, existing Databricks resources in the workspace will be updated based on configuration defined in the bundle it is bound to after the next
It’s a good idea to confirm the bundle workspace before running bind.
databricks bundle deployment bind [job|pipeline-key] [job|pipeline-id]
For example, the following command binds the resource
hello_job to its remote counterpart in the workspace. The command outputs a diff and allows you to deny the resource binding, but if confirmed, any updates to the job definition in the bundle are applied to the corresponding remote job when the bundle is next deployed.
databricks bundle deployment hello_job 6565621249
bundle deployment unbind if you want to remove the link between the job or pipeline in a bundle and its remote counterpart in a workspace.
databricks bundle deployment unbind [job|pipeline-key]
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
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
--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
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
--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
If you want to cancel and restart an existing job run or pipeline update, use the
databricks bundle run --restart
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.