### Example Quality Monitor Setup Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md An example demonstrating how to define a quality monitor with specific table names, output schema, asset directory, inference logging, and a schedule. ```yaml resources: quality_monitors: my_quality_monitor: table_name: dev.mlops_schema.predictions output_schema_name: ${bundle.target}.mlops_schema assets_dir: /Users/${workspace.current_user.userName}/databricks_lakehouse_monitoring inference_log: granularities: [1 day] model_id_col: model_id prediction_col: prediction label_col: price problem_type: PROBLEM_TYPE_REGRESSION timestamp_col: timestamp schedule: quartz_cron_expression: 0 0 8 * * ? # Run Every day at 8am timezone_id: UTC ``` -------------------------------- ### Deploy App with Compute Started Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/lifecycle-started-omitted/output.txt This command deploys an application and starts its compute resources. It includes a deployment to the app and a subsequent start request. ```bash >>> [CLI] bundle deploy ``` ```json { "body": {}, "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/start" } ``` ```json { "body": { "mode": "SNAPSHOT", "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/lifecycle-started-omitted-[UNIQUE_NAME]/default/files/app" }, "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/deployments" } ``` -------------------------------- ### Install project dependencies Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/pydabs/deploy-classic/output.txt Sets up a virtual environment and installs the required Databricks bundles wheel. ```bash >>> uv venv --quiet ``` ```bash >>> uv pip install --quiet [DATABRICKS_BUNDLES_WHEEL] ``` -------------------------------- ### Set up Python Virtual Environment and Install Dependencies Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/README.md Creates a Python virtual environment and installs project dependencies from requirements-dev.txt. Ensure you are in the 'my_dbt_sql' directory. ```bash python3 -m venv .venv . .venv/bin/activate pip install -r requirements-dev.txt ``` -------------------------------- ### Toggle App from Stopped to Started Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/lifecycle-started-toggle/output.txt This sequence shows how to transition an application from a stopped state to a started state. Only the 'start' API call should be invoked, without any update operations. ```python >>> update_file.py databricks.yml started: false started: true ``` ```bash >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/lifecycle-started-toggle-[UNIQUE_NAME]/default/files... Deploying resources... ✓ Deployment succeeded Updating deployment state... Deployment complete! ``` ```json >>> print_app_requests { "body": {}, "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/start" } { "body": { "mode": "SNAPSHOT", "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/lifecycle-started-toggle-[UNIQUE_NAME]/default/files/app" }, "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/deployments" } ``` ```bash >>> errcode [CLI] apps get [UNIQUE_NAME] "ACTIVE" ``` -------------------------------- ### Example Volume Configuration Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md A concrete example of defining a volume named 'my_volume' within the resources block. ```yaml resources: volumes: my_volume: catalog_name: main name: my_volume schema_name: my_schema ``` -------------------------------- ### Example: Create Schema and Pipeline Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md This example demonstrates defining a pipeline that targets a Unity Catalog schema. The schema is created with a name and catalog association. ```yaml resources: pipelines: my_pipeline: name: test-pipeline-{{.unique_id}} libraries: - notebook: path: ./nb.sql development: true catalog: main target: ${resources.schemas.my_schema.id} schemas: my_schema: name: test-schema-{{.unique_id}} catalog_name: main comment: This schema was created by DABs. ``` -------------------------------- ### Update Application via API (Start and Deploy) Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/lifecycle-started/output.txt This sequence of API calls first updates the application's description and then starts it. Finally, a deployment is triggered. ```json { "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/update", "body": { "app": { "description": "MY_APP_DESCRIPTION_3", "name": "[UNIQUE_NAME]" }, "update_mask": "description" } } ``` ```json { "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/start", "body": {} } ``` ```json { "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/deployments", "body": { "mode": "SNAPSHOT", "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/lifecycle-started-[UNIQUE_NAME]/default/files/app" } } ``` -------------------------------- ### Example Unity Catalog Model Serving Endpoint Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md This example demonstrates how to define a Unity Catalog model serving endpoint with a specific model, version, workload size, and traffic routing. Tags can be added for organization. ```yaml resources: model_serving_endpoints: uc_model_serving_endpoint: name: "uc-model-endpoint" config: served_entities: - entity_name: "myCatalog.mySchema.my-ads-model" entity_version: "10" workload_size: "Small" scale_to_zero_enabled: "true" traffic_config: routes: - served_model_name: "my-ads-model-10" traffic_percentage: "100" tags: - key: "team" value: "data science" ``` -------------------------------- ### Toggle App from Started to Stopped Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/lifecycle-started-toggle/output.txt This sequence demonstrates transitioning an application from a started state to a stopped state. Only the 'stop' API call should be made, without any update operations. ```python >>> update_file.py databricks.yml started: true started: false ``` ```bash >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/lifecycle-started-toggle-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... Deployment complete! ``` ```json >>> print_app_requests { "body": {}, "method": "POST", "path": "/api/2.0/apps/[UNIQUE_NAME]/stop" } ``` ```bash >>> errcode [CLI] apps get [UNIQUE_NAME] "STOPPED" ``` -------------------------------- ### Databricks bundle variable flag example Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-sync/output.txt Example of setting variables via the command line using the --var flag. ```bash --var strings set values for variables defined in bundle config. Example: --var="foo=bar" ``` -------------------------------- ### Install project dependencies Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/default-minimal/output/my_default_minimal/README.md Use the uv package manager to install project dependencies in a local development environment. ```bash uv sync --dev ``` -------------------------------- ### Get Databricks CLI Version Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/basic/output.txt Use the --version flag to retrieve the installed Databricks CLI version. This is useful for verifying installation and compatibility. ```bash >>> [CLI] --version Databricks CLI v[DEV_VERSION] ``` -------------------------------- ### Handle Missing Repo Error Source: https://github.com/databricks/cli/blob/main/acceptance/workspace/repos/delete_by_path/output.txt Example output when attempting to retrieve a repository that does not exist. ```bash databricks repos get /Repos/me@databricks.com/test-repo -o json Error: failed to look up repo by path: Workspace path not found Exit code: 1 ``` -------------------------------- ### Deploy and run bundle Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/apps/git_source/output.txt Uploads files and deploys resources, followed by executing the application. ```bash bundle deploy ``` ```bash bundle run my_app ``` -------------------------------- ### Job configuration JSON output Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deployment/unbind/job/output.txt Example JSON structure returned by the jobs get command. ```json { "created_time":[UNIX_TIME_MILLIS], "creator_user_name":"[USERNAME]", "job_id":[NUMID], "run_as_user_name":"[USERNAME]", "settings": { "deployment": { "kind":"BUNDLE", "metadata_file_path":"/Workspace/Users/[USERNAME]/.bundle/my_project/default/state/metadata.json" }, "edit_mode":"UI_LOCKED", "email_notifications": {}, "format":"MULTI_TASK", "max_concurrent_runs":1, "name":"My Job", "queue": { "enabled":true }, "timeout_seconds":0, "webhook_notifications": {} } } ``` -------------------------------- ### Databricks CLI Workspace Get Status Error Handling Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/server/output.txt Example of using the Databricks CLI to get workspace status, showing an error message when the specified path does not exist. The command returns an exit code of 1. ```bash errcode [CLI] workspace get-status /a/b/c Error: Workspace path not found Exit code: 1 ``` -------------------------------- ### Initialize dbt project Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/telemetry/dbt-sql/output.txt Commands to navigate to the newly created project directory and initialize dbt. ```bash cd my_dbt_sql; dbt init ``` -------------------------------- ### Initialize a New Bundle Project Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/default-python/integration_classic/output.txt Create a new project using the default Python template. ```bash [CLI] bundle init default-python --config-file ./input.json --output-dir . ``` -------------------------------- ### Create Multi-Child Job (Python) Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resource_deps/job_id_big_graph/delete_all/output.txt Python script to create a job that can have multiple child tasks. This is a partial example showing the start of the task definition. ```python >>> print_requests.py --sort //jobs { "method": "POST", "path": "/api/2.2/jobs/create", "body": { "deployment": { "kind": "BUNDLE", "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json" }, "edit_mode": "UI_LOCKED", "format": "MULTI_TASK", "max_concurrent_runs": 1, "name": "job multi_child", "queue": { "enabled": true }, "tasks": [ { ``` -------------------------------- ### Inspect Request Headers Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/migrate/basic/output.txt Example output showing User-Agent headers during bundle operations. ```python print_requests.py --get //jobs/get ``` ```json { "headers": { "User-Agent": [ "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct auth/pat" ] }, "method": "GET", "path": "/api/2.2/jobs/get", "q": { "job_id": "[NUMID]" } } { "headers": { "User-Agent": [ "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct auth/pat" ] }, "method": "GET", "path": "/api/2.2/jobs/get", "q": { "job_id": "[NUMID]" } } ``` ```bash print_requests.py --get //jobs/get ``` -------------------------------- ### Generate bundle configuration examples Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-generate-job/output.txt Commands for importing existing jobs into bundle configuration files with various options for directory structure and binding. ```bash databricks bundle generate job --existing-job-id 12345 --key my_etl_job ``` ```bash databricks bundle generate job --existing-job-id 67890 \ --key data_pipeline --config-dir resources --source-dir src ``` ```bash databricks bundle generate job --existing-job-id 12345 --key my_etl_job --bind ``` -------------------------------- ### Attempt to get status of deleted file Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/record_cloud/workspace-file-io/output.txt Attempting to get the status of a file that has been deleted will result in an error. This demonstrates the effect of the delete operation and corresponds to the `GET /api/2.0/workspace/get-status` API. ```bash >>> [CLI] workspace get-status /Users/[USERNAME]/[UNIQUE_NAME]/hello.txt Error: Path (/Users/[USERNAME]/[UNIQUE_NAME]/hello.txt) doesn't exist. Exit code: 1 ``` ```json { "method": "GET", "path": "/api/2.0/workspace/get-status", "q": { "path": "/Users/[USERNAME]/[UNIQUE_NAME]/hello.txt" } } ``` -------------------------------- ### Plan and Deploy Bundle Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/external_locations/output.txt Use 'bundle plan' to preview changes and 'bundle deploy' to apply them. Ensure all necessary resources are defined in the bundle configuration. ```bash >>> [CLI] bundle plan create catalogs.test_catalog create catalogs.test_catalog.grants create external_locations.test_location create external_locations.test_location.grants Plan: 4 to add, 0 to change, 0 to delete, 0 unchanged ``` ```bash >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files... Deploying resources... Updating deployment state... Deployment complete! ``` -------------------------------- ### Get a pipeline Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/record_cloud/pipeline-crud/output.txt Retrieves pipeline details using the CLI and shows the underlying GET request. ```bash [CLI] pipelines get [UUID] ``` ```json { "method": "GET", "path": "/.well-known/databricks-config" } { "method": "GET", "path": "/api/2.0/pipelines/[UUID]" } ``` -------------------------------- ### Plan and Deploy Bundle Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/update/output.txt Initializes the deployment process by planning and applying changes to the workspace. ```bash >>> [CLI] bundle plan create apps.mykey Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged ``` ```bash >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... Deploying resources... Updating deployment state... Deployment complete! ``` -------------------------------- ### Plan and Deploy Bundle Resources Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/jobs/update/output.txt Use bundle plan to preview changes and deploy resources to the workspace. ```bash [CLI] bundle plan ``` ```bash [CLI] bundle plan -o json ``` -------------------------------- ### Databricks CLI: Start and Delete Cluster Source: https://context7.com/databricks/cli/llms.txt Commands to start and delete a Databricks cluster using its ID. ```bash databricks clusters start --cluster-id 0123-456789-abcde ``` ```bash databricks clusters delete --cluster-id 0123-456789-abcde ``` -------------------------------- ### Check Chocolatey Version Source: https://github.com/databricks/cli/blob/main/acceptance/README.md Verify the installation of Chocolatey by checking its version. This is a prerequisite for installing other tools on Windows. ```powershell PS C:\WINDOWS\system32> choco --version 2.5.1 ``` -------------------------------- ### Deploy Bundle with Jobs Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resource_deps/job_id_delete_bar/output.txt This example shows the CLI command to deploy a bundle, which includes creating two jobs: 'job bar' and 'job foo'. The API requests generated by `print_requests.py` illustrate the POST calls to create these jobs. ```bash >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... Deploying resources... Updating deployment state... Deployment complete! ``` ```json { "method": "POST", "path": "/api/2.2/jobs/create", "body": { "deployment": { "kind": "BUNDLE", "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json" }, "edit_mode": "UI_LOCKED", "format": "MULTI_TASK", "max_concurrent_runs": 1, "name": "job bar", "queue": { "enabled": true } } } ``` ```json { "method": "POST", "path": "/api/2.2/jobs/create", "body": { "deployment": { "kind": "BUNDLE", "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json" }, "edit_mode": "UI_LOCKED", "format": "MULTI_TASK", "max_concurrent_runs": 1, "name": "job foo", "queue": { "enabled": true }, "tasks": [ { "run_job_task": { "job_id": [BAR_ID] }, "task_key": "job_task" } ] } } ``` -------------------------------- ### Update Application Configuration and Deploy Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/lifecycle-started/output.txt Updates the application's configuration to `started: true` and a new description, then deploys the changes. This ensures the compute is restarted and the code is updated. ```bash update_file.py databricks.yml started: false started: true ``` ```bash update_file.py databricks.yml MY_APP_DESCRIPTION_2 MY_APP_DESCRIPTION_3 ``` ```bash errcode [CLI] bundle deploy ``` -------------------------------- ### Set bundle configuration variables Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-generate-pipeline/output.txt Example of passing variables to the bundle configuration during command execution. ```bash --var="foo=bar" ``` -------------------------------- ### Deploy Bundle with Databricks CLI Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/artifacts/whl_prebuilt_multiple/output.txt This example demonstrates the output of deploying a bundle using the Databricks CLI. It shows the process of uploading wheel files and deploying resources. ```bash >>> [CLI] bundle deploy Uploading dist/lib/other_test_code-0.0.1-py3-none-any.whl... Uploading dist/my_test_code-0.0.1-py3-none-any.whl... Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... Deploying resources... Updating deployment state... Deployment complete! ``` -------------------------------- ### Library Installation Configuration Source: https://github.com/databricks/cli/blob/main/python/docs/databricks.bundles.jobs.md Configuration for installing libraries, supporting requirements.txt files and wheel packages from various URI types. ```APIDOC ## Library Installation Configuration ### Description Configuration for installing libraries, supporting requirements.txt files and wheel packages from various URI types. ### Parameters #### Request Body - **requirements** (str | None) - Optional - URI of the requirements.txt file to install. Only Workspace paths and Unity Catalog Volumes paths are supported. - **whl** (str | None) - Optional - URI of the wheel library to install. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. ### Request Example ```json { "requirements": "/Workspace/path/to/requirements.txt" } ``` ```json { "whl": "s3://my-bucket/library.whl" } ``` ``` -------------------------------- ### Run a simple command with 'bundle run' Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/run/inline-script/basic/output.txt Execute a basic command like 'echo hello, world' using 'bundle run'. This is useful for verifying bundle execution. ```bash [CLI] bundle run -- echo hello, world ``` -------------------------------- ### Get Catalog Details Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/external_locations/output.txt Retrieve the details of a specific catalog using the 'catalogs get' command. This is useful for verifying creation and properties. ```bash >>> [CLI] catalogs get test_catalog_[UNIQUE_NAME] { "name": "test_catalog_[UNIQUE_NAME]", "comment": "Test catalog for external locations", "properties": { "owner": "dabs" } } ``` -------------------------------- ### Plan Bundle Deployment Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deployment/bind/pipelines/recreate/output.txt Preview the changes that will be applied to the workspace, including pipeline recreations. ```bash [CLI] bundle plan ``` -------------------------------- ### Handle bundle deployment errors Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist/output.txt Example of an error output when a referenced volume does not exist during deployment. ```text Error: volume main.schema-[UNIQUE_NAME].doesnotexist does not exist at workspace.artifact_path in databricks.yml:6:18 ``` -------------------------------- ### Get Catalog Grants Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/external_locations/output.txt Verify the grants assigned to a catalog using the 'grants get catalog' command. This confirms access control configurations. ```bash >>> [CLI] grants get catalog test_catalog_[UNIQUE_NAME] { "privilege_assignments": [ { "principal": "deco-test-user@databricks.com", "privileges": [ "CREATE_SCHEMA", "USE_CATALOG" ] } ] } ``` -------------------------------- ### Plan bundle deployment Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/apps/git_source/output.txt Previews the changes that will be applied to the workspace. ```bash bundle plan ``` -------------------------------- ### Install Databricks Bundles Wheel Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/pydabs/check-consistency/output.txt Installs the necessary Databricks Bundles wheel using uv pip. This is a prerequisite for using Databricks bundles. ```bash uv pip install --quiet [DATABRICKS_BUNDLES_WHEEL] ``` -------------------------------- ### Get External Location Grants Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/external_locations/output.txt Verify the grants assigned to an external location using the 'grants get external_location' command. This confirms read/write permissions. ```bash >>> [CLI] grants get external_location test_ext_location_[UNIQUE_NAME] { "privilege_assignments": [ { "principal": "deco-test-user@databricks.com", "privileges": [ "READ_FILES", "WRITE_FILES" ] } ] } ``` -------------------------------- ### Deploy a sample dashboard Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md Example configuration for deploying the NYC Taxi Trip Analysis dashboard to a Databricks workspace. ```yaml 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} ``` -------------------------------- ### Execute Bundle Plan and Deploy Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/permissions/pipelines/update/output.txt Commands to generate a deployment plan in JSON format and execute the bundle deployment. ```bash >>> [CLI] bundle plan -o json >>> [CLI] bundle deploy ``` -------------------------------- ### Create a Databricks application Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/generate/app_not_yet_deployed/output.txt Initializes a new application and returns the status and service principal details. ```bash >>> [CLI] apps create my-app { "app_status": { "message":"Application is running.", "state":"RUNNING" }, "compute_size":"MEDIUM", "compute_status": { "message":"App compute is active.", "state":"ACTIVE" }, "id":"1000", "name":"my-app", "service_principal_client_id":"[UUID]", "service_principal_id":[NUMID], "service_principal_name":"app-my-app", "url":"my-app-123.cloud.databricksapps.com" } ``` -------------------------------- ### Deploy bundle with plan Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deploy/readplan/basic/output.txt Executes a bundle deployment using a specified plan file. ```bash [CLI] bundle deploy --plan out.plan_create.json ``` ```bash [CLI] bundle deploy --plan out.plan_skip.json ``` -------------------------------- ### Example annotation configuration Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/README.md Demonstrates how to annotate various fields within a Bundle configuration, including the use of placeholders to hide fields. ```yaml github.com/databricks/cli/bundle/config.Bundle: "cluster_id": "description": |- The ID of a cluster to use to run the bundle. "markdown_description": |- The ID of a cluster to use to run the bundle. See [_](/dev-tools/bundles/settings.md#cluster_id). "compute_id": "description": |- PLACEHOLDER "databricks_cli_version": "description": |- The Databricks CLI version to use for the bundle. "markdown_description": |- The Databricks CLI version to use for the bundle. See [_](/dev-tools/bundles/settings.md#databricks_cli_version). "deployment": "description": |- The definition of the bundle deployment "markdown_description": |- The definition of the bundle deployment. For supported attributes, see [_](#deployment) and [_](/dev-tools/bundles/deployment-modes.md). "git": "description": |- The Git version control details that are associated with your bundle. "markdown_description": |- The Git version control details that are associated with your bundle. For supported attributes, see [_](#git) and [_](/dev-tools/bundles/settings.md#git). "name": "description": |- The name of the bundle. "uuid": "description": |- PLACEHOLDER ``` -------------------------------- ### Start Cluster with Autoscale Configuration Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/clusters/deploy/update-and-resize-autoscale/output.txt This JSON represents the state of a running cluster, including its autoscale configuration, termination settings, and other attributes. It is used when starting or updating a running cluster. ```json { "autoscale": { "max_workers":5, "min_workers":3 }, "autotermination_minutes":60, "aws_attributes": { "availability":"SPOT_WITH_FALLBACK", "zone_id":"us-east-1c" }, "cluster_id":"[CLUSTER_ID]", "cluster_name":"test-cluster-[UNIQUE_NAME]", "driver_node_type_id":"[NODE_TYPE_ID]", "enable_elastic_disk":false, "node_type_id":"[NODE_TYPE_ID]", "spark_version":"13.3.x-snapshot-scala2.12", "state":"RUNNING" } ``` -------------------------------- ### Create a Catalog Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deployment/bind/catalog/output.txt Creates a new catalog in the Unity Catalog. ```bash >>> [CLI] catalogs create test-catalog-[UNIQUE_NAME] { "comment": null, "name": "test-catalog-[UNIQUE_NAME]" } ``` -------------------------------- ### Get Repository Information (Invalid Path) Source: https://github.com/databricks/cli/blob/main/acceptance/workspace/repos/get_errors/output.txt Trying to get repository information for a path that does not point to a repository will return an error. Verify that the specified path corresponds to a valid repository. ```bash >>> [CLI] repos get /not-a-repo -o json Error: object at path "/not-a-repo" is not a repo Exit code: 1 ``` -------------------------------- ### Install Development Tools on Windows Source: https://github.com/databricks/cli/blob/main/acceptance/README.md Install essential development tools using Chocolatey for running Databricks CLI acceptance tests on Windows. Ensure PowerShell is run as administrator. ```powershell choco install -y vscode choco install -y git choco install -y make choco install -y jq choco install -y python3 choco install -y uv choco install -y go choco install -y nodejs ``` -------------------------------- ### Get file status using CLI Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/record_cloud/workspace-file-io/output.txt Use the `workspace get-status` command to retrieve information about a file or folder in the Databricks workspace. This operation is equivalent to calling the `GET /api/2.0/workspace/get-status` API. ```bash >>> [CLI] workspace get-status /Users/[USERNAME]/[UNIQUE_NAME]/hello.txt { "path": "/Users/[USERNAME]/[UNIQUE_NAME]/hello.txt", "object_type": "FILE" } ``` ```json { "method": "GET", "path": "/api/2.0/workspace/get-status", "q": { "path": "/Users/[USERNAME]/[UNIQUE_NAME]/hello.txt" } } ``` -------------------------------- ### Deploy Bundle with run_as Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/run_as/job_default/output.txt Deploys a bundle and verifies the job creation request with the run_as user configuration. ```bash [CLI] bundle deploy ``` ```json { "method": "POST", "path": "/api/2.2/jobs/create", "body": { "deployment": { "kind": "BUNDLE", "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/state/metadata.json" }, "edit_mode": "UI_LOCKED", "format": "MULTI_TASK", "max_concurrent_runs": 1, "name": "Untitled", "queue": { "enabled": true }, "run_as": { "user_name": "deco-test-user@databricks.com" }, "tasks": [ { "new_cluster": { "node_type_id": "[NODE_TYPE_ID]", "num_workers": 1, "spark_version": "13.3.x-snapshot-scala2.12" }, "notebook_task": { "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/files/test" }, "task_key": "task_one" } ] } } ``` ```bash [CLI] jobs get [NUMID] ``` ```json { "user_name": "deco-test-user@databricks.com" } ``` -------------------------------- ### Handle Non-existent Resource Errors with Databricks CLI Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resource_deps/pipelines_recreate/output.txt Use `musterr` to verify that commands like `pipelines get` or `jobs get` correctly return errors for non-existent resource IDs. ```bash >>> musterr [CLI] pipelines get [FOO_ID] Error: The specified pipeline [FOO_ID] was not found. ``` ```bash >>> musterr [CLI] pipelines get [FOO_ID] Error: The specified pipeline [FOO_ID] was not found. ``` ```bash >>> musterr [CLI] jobs get [BAR_ID] Error: Not Found ``` -------------------------------- ### Example Databricks Pipeline Definition Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md An example of a Databricks pipeline configuration using YAML. This snippet demonstrates how to define a pipeline with specific cluster settings, development mode, and library paths. ```yaml resources: pipelines: hello-pipeline: name: hello-pipeline clusters: - label: default num_workers: 1 development: true continuous: false channel: CURRENT edition: CORE photon: false libraries: - notebook: path: ./pipeline.py ``` -------------------------------- ### Initialize a Scala project with Databricks Asset Bundles Source: https://github.com/databricks/cli/blob/main/libs/template/templates/default-scala/README.md Use this command to initialize a new project based on the default-scala template from the official Databricks bundle examples repository. ```bash databricks bundle init --template-dir contrib/templates/default-scala https://github.com/databricks/bundle-examples ``` -------------------------------- ### Retrieve bundle and app details Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/apps/git_source/output.txt Fetches configuration summaries and specific app details in JSON format. ```bash bundle summary --output json ``` ```bash apps get [APP_NAME] --output json ``` -------------------------------- ### Databricks YAML Volume Configuration Examples Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/validate/volume_defaults/output.txt Illustrates different volume configurations, including valid and invalid settings for volume_type. The 'v3' example shows a correct 'MANAGED' volume type. ```yaml { "v1": { "volume_type": "" }, "v2": { "volume_type": "already-set" }, "v3": { "comment": "hello", "volume_type": "MANAGED" } } ``` -------------------------------- ### Plan and Deploy Registered Model Creation Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/registered_models/basic/output.txt Use 'bundle plan' to preview the creation of a registered model and 'bundle deploy' to execute the creation. This process involves uploading bundle files and deploying resources. ```bash [CLI] bundle plan create registered_models.my_registered_model ``` ```bash [CLI] bundle deploy ``` -------------------------------- ### Start Cluster Configuration Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/clusters/deploy/update-and-resize/output.txt This JSON object represents the configuration parameters used when starting a cluster. It includes details like node types, worker count, Spark version, and desired state. ```json { "autotermination_minutes":60, "aws_attributes": { "availability":"SPOT_WITH_FALLBACK", "zone_id":"us-east-1c" }, "cluster_id":"[CLUSTER_ID]", "cluster_name":"test-cluster-[UNIQUE_NAME]", "driver_node_type_id":"[NODE_TYPE_ID]", "enable_elastic_disk":false, "node_type_id":"[NODE_TYPE_ID]", "num_workers":3, "spark_conf": { "spark.executor.memory":"2g" }, "spark_version":"13.3.x-snapshot-scala2.12", "state":"RUNNING" } ``` -------------------------------- ### Get Databricks Lakeview Dashboard Details Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/dashboards/change-parent-path/output.txt Retrieve information about a Databricks Lakeview dashboard using `lakeview get [DASHBOARD_ID]`. This command returns details such as display name, lifecycle state, and path. ```bash >>> [CLI] lakeview get [ORIGINAL_DASHBOARD_ID] { "display_name": "test dashboard", "lifecycle_state": "ACTIVE", "parent_path": "/Users/[USERNAME]/.bundle/change-parent-path-[UNIQUE_NAME]/default/resources", "path": "/Users/[USERNAME]/.bundle/change-parent-path-[UNIQUE_NAME]/default/resources/test dashboard.lvdash.json", "serialized_dashboard": "{} ", "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" } ``` ```bash >>> [CLI] lakeview get [NEW_DASHBOARD_ID] { "display_name": "test dashboard", "lifecycle_state": "ACTIVE", "parent_path": "/Users/[USERNAME]/.bundle/change-parent-path-[UNIQUE_NAME]/default/resources2", "path": "/Users/[USERNAME]/.bundle/change-parent-path-[UNIQUE_NAME]/default/resources2/test dashboard.lvdash.json", "serialized_dashboard": "{} ", "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" } ``` -------------------------------- ### Initialize a new Python Bundle Project Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/migrate/default-python/output.txt Use 'bundle init' to create a new project from a template. Customize your project by answering prompts, which will be saved in 'databricks.yml'. Ensure DATABRICKS_URL is configured. ```bash >>> [CLI] bundle init default-python --config-file ./input.json ``` -------------------------------- ### Print API Request for Getting Job Details Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/migrate/permissions/output.txt This command prints the details of an API request to get job information. It shows the HTTP method, path, and query parameters, including the job ID. ```bash print_requests.py --get //jobs/get ``` -------------------------------- ### Initialize Databricks Bundle Projects Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-init/output.txt Commands to initialize a new project using different template types or output directories. ```bash databricks bundle init ``` ```bash databricks bundle init default-python ``` ```bash databricks bundle init dbt-sql ``` ```bash databricks bundle init --output-dir ./my-project ``` -------------------------------- ### View Bundle Summary Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/apps/update/output.txt Displays the current state and configuration of the deployed bundle. ```bash >>> [CLI] bundle summary Name: test-bundle Target: default Workspace: User: [USERNAME] Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default Resources: Apps: mykey: Name: myappname URL: (not deployed) ``` -------------------------------- ### Get Registered Model Details Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/registered_models/basic/output.txt Retrieve the details of a registered model using the 'registered-models get' command, specifying the model's full name. The output shows the model's name, comment, catalog, and schema. ```bash [CLI] registered-models get main.default.my-registered-model-[UNIQUE_NAME] ``` -------------------------------- ### Plan Bundle Deployment Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/state/state_present/output.txt Previews bundle changes using different engine configurations. ```bash DATABRICKS_BUNDLE_ENGINE=direct [CLI] bundle plan ``` ```bash DATABRICKS_BUNDLE_ENGINE=terraform [CLI] bundle plan ``` ```bash DATABRICKS_BUNDLE_ENGINE= [CLI] bundle plan ``` -------------------------------- ### Run Integration Tests with Make Source: https://github.com/databricks/cli/blob/main/integration/README.md Alternatively, use the make command to run all integration tests. This is a convenient shortcut for the go test command. ```bash make integration ``` -------------------------------- ### jobs._name_.tasks.libraries.pypi Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md Specification for PyPi library installation. ```APIDOC ## jobs._name_.tasks.libraries.pypi ### Description Specification of a PyPi library to be installed. ### Parameters #### Request Body - **package** (String) - Required - The name of the pypi package to install. - **repo** (String) - Optional - The repository where the package can be found. ``` -------------------------------- ### Open bundle resources via CLI Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-open/output.txt Use these commands to navigate to specific resources or trigger an interactive selection prompt after deployment. ```bash databricks bundle open ``` ```bash databricks bundle open my_job ``` ```bash databricks bundle open my_dashboard ``` -------------------------------- ### jobs._name_.tasks.libraries.maven Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md Specification for Maven library installation. ```APIDOC ## jobs._name_.tasks.libraries.maven ### Description Specification of a maven library to be installed. ### Parameters #### Request Body - **coordinates** (String) - Required - Gradle-style maven coordinates. - **exclusions** (Sequence) - Optional - List of dependencies to exclude. - **repo** (String) - Optional - Maven repo to install the package from. ``` -------------------------------- ### jobs._name_.tasks.libraries.cran Source: https://github.com/databricks/cli/blob/main/bundle/docsgen/output/resources.md Specification for CRAN library installation. ```APIDOC ## jobs._name_.tasks.libraries.cran ### Description Specification of a CRAN library to be installed as part of the library. ### Parameters #### Request Body - **package** (String) - Required - The name of the CRAN package to install. - **repo** (String) - Optional - The repository where the package can be found. ``` -------------------------------- ### Example Lakeview Dashboard Configuration Output Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/dashboards/unpublish-out-of-band/out.get_published.direct.txt This is an example of the JSON output you can expect when retrieving a published Lakeview dashboard's configuration. It includes display name, embed credentials status, revision creation time, and warehouse ID. ```json { "display_name":"test bundle-deploy-dashboard [UNIQUE_NAME]", "embed_credentials":false, "revision_create_time":"[TIMESTAMP]", "warehouse_id":"[TEST_DEFAULT_WAREHOUSE_ID]" } ``` -------------------------------- ### Plan Bundle Deployment Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/dashboards/delete-trashed-out-of-band/output.txt Previews changes to be applied to the bundle, with optional JSON output. ```bash >>> [CLI] bundle plan create dashboards.dashboard1 Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged ``` ```bash >>> [CLI] bundle plan -o json ``` -------------------------------- ### Deploy Initialized Bundle Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-init/output.txt Command to deploy the project after initialization. ```bash databricks bundle deploy --target dev ``` -------------------------------- ### GET /api/2.0/workspace/get-status Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/server/out.requests.txt Retrieves the status of a workspace operation. ```APIDOC ## GET /api/2.0/workspace/get-status ### Description Retrieves the status of a workspace operation. ### Method GET ### Endpoint /api/2.0/workspace/get-status ### Parameters #### Query Parameters - **path** (string) - Required - The path to the workspace object. ### Request Example ### Response #### Success Response (200) #### Response Example ``` -------------------------------- ### Initialize Databricks Projects Source: https://context7.com/databricks/cli/llms.txt Create new projects using built-in templates or external Git repositories. ```bash # Choose from built-in templates interactively databricks bundle init # Initialize Python project with jobs and notebooks databricks bundle init default-python # Initialize dbt + SQL warehouse project databricks bundle init dbt-sql # Initialize with custom output directory databricks bundle init default-python --output-dir ./my-project # Initialize from Git repository databricks bundle init https://github.com/my-org/my-template # Initialize from Git with specific branch databricks bundle init https://github.com/my-org/my-template --branch main ``` -------------------------------- ### GET /custom/endpoint Source: https://github.com/databricks/cli/blob/main/acceptance/selftest/server/out.requests.txt A custom endpoint with a query parameter. ```APIDOC ## GET /custom/endpoint ### Description A custom endpoint with a query parameter. ### Method GET ### Endpoint /custom/endpoint ### Parameters #### Query Parameters - **query** (string) - Required - The query parameter for the custom endpoint. ### Request Example ### Response #### Success Response (200) #### Response Example ``` -------------------------------- ### GET /pipelines/get Source: https://github.com/databricks/cli/blob/main/acceptance/pipelines/databricks-cli-help/output.txt Retrieve details for a specific pipeline. ```APIDOC ## GET /pipelines/get ### Description Fetches the configuration and status details for a specific pipeline. ### Method GET ### Endpoint /pipelines/get ``` -------------------------------- ### Plan and Deploy with Direct Engine Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/migrate/basic/output.txt Commands to plan and deploy bundles using the direct engine configuration. ```bash DATABRICKS_BUNDLE_ENGINE=terraform [CLI] bundle plan ``` ```bash DATABRICKS_BUNDLE_ENGINE=terraform [CLI] bundle deploy ``` ```bash DATABRICKS_BUNDLE_ENGINE=direct [CLI] bundle plan ``` ```bash DATABRICKS_BUNDLE_ENGINE= [CLI] bundle plan ``` ```bash DATABRICKS_BUNDLE_ENGINE= [CLI] bundle deploy ``` -------------------------------- ### Databricks bundle sync usage examples Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/help/bundle-sync/output.txt Common command-line patterns for synchronizing local bundle files to the workspace. ```bash databricks bundle sync # One-time sync of all files ``` ```bash databricks bundle sync --watch # Continuously watch and sync changes ``` ```bash databricks bundle sync --full # Force full sync (vs incremental) ``` ```bash databricks bundle sync --dry-run # Preview what would be synced ``` -------------------------------- ### GET /pipelines/list Source: https://github.com/databricks/cli/blob/main/acceptance/pipelines/databricks-cli-help/output.txt Retrieve a list of all available pipelines. ```APIDOC ## GET /pipelines/list ### Description Lists all pipelines configured in the current environment. ### Method GET ### Endpoint /pipelines/list ``` -------------------------------- ### Handle Destructive Deployment Actions Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/volumes/recreate/output.txt Demonstrates how to handle destructive volume recreations using the --auto-approve flag. ```bash >>> errcode [CLI] bundle deploy --var=schema_name=${resources.schemas.schema2.name} ``` ```bash >>> [CLI] bundle deploy --var=schema_name=${resources.schemas.schema2.name} --auto-approve ``` -------------------------------- ### GET /api/2.0/workspace/get-status Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/run/scripts/databricks-cli/target-is-passed/default/out.requests.txt Retrieves the status of a workspace object. ```APIDOC ## GET /api/2.0/workspace/get-status ### Description Retrieves the status of a workspace object. ### Method GET ### Endpoint /api/2.0/workspace/get-status ### Query Parameters - **path** (string) - Required - The path to the workspace object. ### Headers - **Authorization** (string) - Required - Bearer token for authentication. ``` -------------------------------- ### GET /.well-known/databricks-config Source: https://github.com/databricks/cli/blob/main/acceptance/apps/deploy/bundle-with-appname/out.requests.txt Retrieves the Databricks configuration information. ```APIDOC ## GET /.well-known/databricks-config ### Description Retrieves the Databricks configuration information. ### Method GET ### Endpoint /.well-known/databricks-config ``` -------------------------------- ### GET /.well-known/databricks-config Source: https://github.com/databricks/cli/blob/main/acceptance/apps/deploy/no-bundle-with-appname/out.requests.txt Retrieves the Databricks configuration information. ```APIDOC ## GET /.well-known/databricks-config ### Description Retrieves the configuration details for the Databricks environment. ### Method GET ### Endpoint /.well-known/databricks-config ``` -------------------------------- ### Inspect Configuration Differences Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/resources/permissions/jobs/update/output.txt Use a diff tool to compare the current configuration with a saved version. ```bash diff.py databricks.yml.saved databricks.yml ``` -------------------------------- ### GET /.well-known/databricks-config Source: https://github.com/databricks/cli/blob/main/acceptance/auth/credentials/pat/out.requests.txt Retrieves Databricks configuration information. ```APIDOC ## GET /.well-known/databricks-config ### Description Retrieves Databricks configuration information. ### Method GET ### Endpoint /.well-known/databricks-config ### Headers - **User-Agent** (string) - Required - The User-Agent header, typically including client version information. ``` -------------------------------- ### Bind Database Instance to Bundle Deployment Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deployment/bind/database_instance/output.txt Binds a database instance to a bundle deployment. Use this command to associate a specific database instance with your bundle. Run 'bundle deploy' to apply changes. ```bash >>> [CLI] bundle deployment bind database_instance1 [UUID] --auto-approve Updating deployment state... Successfully bound database_instance with an id '[UUID]' Run 'bundle deploy' to deploy changes to your workspace ``` -------------------------------- ### Display Bundle Deployment Summary After Unbind Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/deployment/bind/database_instance/output.txt Shows the bundle deployment summary after unbinding a database instance. This output indicates that the database instance is no longer deployed. ```bash >>> [CLI] bundle summary Name: test-bundle Target: default Workspace: User: [USERNAME] Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default Resources: Database instances: database_instance1: Name: test-instance-02 URL: (not deployed) ``` -------------------------------- ### RCranLibrary Source: https://github.com/databricks/cli/blob/main/python/docs/databricks.bundles.jobs.md Specifies an R package to install from CRAN. ```APIDOC ## RCranLibrary Defines an R package to be installed from the Comprehensive R Archive Network (CRAN). ### Fields - **package** (str) - The name of the CRAN package to install. - **repo** (str | None) - The repository where the package can be found. If not specified, the default CRAN repo is used. Defaults to None. ``` -------------------------------- ### PythonPyPiLibrary Source: https://github.com/databricks/cli/blob/main/python/docs/databricks.bundles.jobs.md Specifies a Python library to install from PyPI. ```APIDOC ## PythonPyPiLibrary Defines a Python library to be installed from the Python Package Index (PyPI). ### Fields - **package** (str) - The name of the PyPI package to install. An optional exact version specification is also supported (e.g., "simplejson" and "simplejson==3.8.0"). - **repo** (str | None) - The repository where the package can be found. If not specified, the default pip index is used. Defaults to None. ``` -------------------------------- ### Initialize PyDABs project Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/pydabs/deploy-classic/output.txt Initializes a new project using the PyDABs template with a specified configuration file. ```bash >>> [CLI] bundle init pydabs --config-file ./input.json ``` -------------------------------- ### Initialize a new Databricks bundle project Source: https://github.com/databricks/cli/blob/main/acceptance/bundle/templates/default-python/combinations/classic/output.txt Creates a new project directory using the default Python template based on a provided configuration file. ```bash [CLI] bundle init default-python --config-file ./input.json ``` -------------------------------- ### GET /repos Source: https://github.com/databricks/cli/blob/main/acceptance/workspace/repos/update/output.txt Retrieves details of a specific repository by ID. ```APIDOC ## GET /repos ### Description Retrieves the configuration and status of a repository by its ID. ### Method GET ### Parameters - **id** (number) - Required - The unique identifier of the repository. ### Response - **branch** (string) - The current branch. - **id** (number) - The repository ID. - **path** (string) - The path in Databricks. - **provider** (string) - The Git provider. - **url** (string) - The Git repository URL. ### Response Example { "branch": "update-by-id", "id": [NUMID], "path": "/Repos/me@databricks.com/test-repo", "provider": "gitHub", "url": "https://github.com/databricks/databricks-empty-ide-project.git" } ```