Databricks CLI
Go to file
Gleb Kanterov 3d91691f25
PythonMutator: propagate source locations (#1783)
## Changes
Add a mechanism to load Python source locations in the Python mutator.
Previously, locations pointed to generated YAML. Now, they point to
Python sources instead. Python process outputs "locations.json"
containing locations of bundle paths, examples:

```json
{"path": "resources.jobs.job_0", "file": "resources/job_0.py", "line": 3, "column": 5}
{"path": "resources.jobs.job_0.tasks[0].task_key", "file": "resources/job_0.py", "line": 10, "column": 5}
{"path": "resources.jobs.job_1", "file": "resources/job_1.py", "line": 5, "column": 7}
```

Such locations form a tree, and we assign locations of the closest
ancestor to each `dyn.Value` based on its path. For example,
`resources.jobs.job_0.tasks[0].task_key` is located at `job_0.py:10:5`
and `resources.jobs.job_0.tasks[0].email_notifications` is located at
`job_0.py:3:5`, because we use the location of the job as the most
precise approximation.

This feature is only enabled if `experimental/python` is used.

Note: for now, we don't update locations with relative paths, because it
has a side effect in changing how these paths are resolved

## Example
```
% databricks bundle validate

Warning: job_cluster_key abc is not defined
  at resources.jobs.examples.tasks[0].job_cluster_key
  in resources/example.py:10:1
```

## Tests
Unit tests and manually
2025-01-22 15:37:37 +00:00
.codegen Process all the fields in top level request object even if it contains request body (#2155) 2025-01-15 17:02:58 +01:00
.github Run tests with coverage on CI (#2141) 2025-01-20 15:41:24 +00:00
.vscode Remove unused vscode settings in the templates (#2013) 2024-12-13 16:13:21 +00:00
acceptance Use local git config in tests (#2205) 2025-01-22 12:20:49 +01:00
bundle PythonMutator: propagate source locations (#1783) 2025-01-22 15:37:37 +00:00
cmd Fix duplicate "apps" entry in help output (#2191) 2025-01-20 16:02:29 +00:00
docker Followup improvements to the Docker setup script (#1369) 2024-04-18 20:52:11 +00:00
docs Removed autogenerated docs for the CLI commands (#1392) 2024-04-23 13:25:25 +00:00
integration Refactor `bundle init` (#2074) 2025-01-20 12:09:28 +00:00
internal Add NoLog option on testcli.Runner (#2183) 2025-01-20 09:57:48 +01:00
libs Add `auth.Env` function (#2204) 2025-01-22 12:14:54 +00:00
.codegen.json Custom annotations for bundle-specific JSON schema fields (#1957) 2024-12-18 10:19:14 +00:00
.git-blame-ignore-revs Add .git-blame-ignore-revs with linter-related mass change commits (#2000) 2024-12-12 10:54:00 +01:00
.gitattributes Upgrade Go SDK to 0.54.0 (#2029) 2024-12-18 12:43:27 +00:00
.gitignore Format Python code with ruff (#2166) 2025-01-17 07:38:47 +00:00
.golangci.yaml Fix incorrect TestingT.Errorf usage and enable linting for this (#2182) 2025-01-20 08:07:42 +00:00
.goreleaser.yaml Address goreleaser deprecation warning (#1872) 2024-10-31 12:09:23 +00:00
.mockery.yaml Use mockery to generate mocks compatible with testify/mock (#1190) 2024-02-08 15:18:53 +00:00
CHANGELOG.md [Release] Release v0.239.0 (#2167) 2025-01-16 16:25:17 +00:00
Dockerfile Followup improvements to the Docker setup script (#1369) 2024-04-18 20:52:11 +00:00
LICENSE Trim trailing whitespace (#1206) 2024-02-15 16:23:48 +00:00
Makefile Run tests with coverage on CI (#2141) 2025-01-20 15:41:24 +00:00
NOTICE Add tests for default-python template on different Python versions (#2025) 2024-12-20 14:40:54 +00:00
README.md Add privacy notice to README (#1841) 2024-10-28 18:19:55 +00:00
go.mod Bump github.com/databricks/databricks-sdk-go from 0.54.0 to 0.55.0 (#2126) 2025-01-14 16:02:34 +00:00
go.sum Bump github.com/databricks/databricks-sdk-go from 0.54.0 to 0.55.0 (#2126) 2025-01-14 16:02:34 +00:00
main.go Add regression tests for CLI error output (#1566) 2024-07-10 06:38:06 +00:00
main_test.go Fix ability to import the CLI repository as module (#1671) 2024-08-12 14:20:04 +00:00

README.md

Databricks CLI

build

This project is in Public Preview.

Documentation is available at https://docs.databricks.com/dev-tools/cli/databricks-cli.html.

Installation

This CLI is packaged as a dependency-free binary executable and may be located in any directory. See https://github.com/databricks/cli/releases for releases and the Databricks documentation for detailed information about installing the CLI.


Homebrew

We maintain a Homebrew tap for installing the Databricks CLI. You can find instructions for how to install, upgrade and downgrade the CLI using Homebrew here.


Docker

You can use the CLI via a Docker image by pulling the image from ghcr.io. You can find all available versions at: https://github.com/databricks/cli/pkgs/container/cli.

docker pull ghcr.io/databricks/cli:latest

Example of how to run the CLI using the Docker image. More documentation is available at https://docs.databricks.com/dev-tools/bundles/airgapped-environment.html.

docker run -e DATABRICKS_HOST=$YOUR_HOST_URL -e DATABRICKS_TOKEN=$YOUR_TOKEN ghcr.io/databricks/cli:latest current-user me

Authentication

This CLI follows the Databricks Unified Authentication principles.

You can find a detailed description at https://github.com/databricks/databricks-sdk-go#authentication.

Privacy Notice

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.