This article describes how to migrate from Databricks CLI version 0.18 or below to Databricks CLI version 0.205 or above. Databricks CLI versions 0.205 and above are in Public Preview.
For brevity, this article refers to Databricks CLI versions 0.18 and below as the âlegacyâ CLI, and Databricks CLI versions 0.205 and above as the ânewâ CLI.
For more information about the legacy and new CLIs, see:
If you have the legacy CLI installed and you want to uninstall it, use pip
(or pip3
, depending on your version of Python) to run the uninstall
command, as follows:
Bash
pip uninstall databricks-cli
Install the new CLIâ
To learn how to install the new CLI, see Install or update the Databricks CLI.
Verify your CLI installationâIf you are not sure whether you are using the new CLI, follow the instructions in this section to verify and adjust as needed. Before you follow these instructions, make sure to exit any Python virtual environments, conda
environments, or similar environments.
To check the version of your default installation of the CLI, run the following command:
If the version number is not what you expect, do one of the following:
PATH
so that the path to the remaining version of the CLI that you want to use is listed.PATH
. Note that you must still prepend the full path to versions of the CLI that are not listed first in your operating system's PATH
.To update your operating system's PATH
, do the following:
List the paths where databricks
is installed by running one of the following commands:
Bash
which -a databricks
where databricks
Get the path to the installation that you want to use without prepending the full path to each and every call to the CLI. If you are not sure which path this is, run the full path to each location, followed by -v
, for example:
Bash
/usr/local/bin/databricks -v
To put the path to the installation that you want to use first in your PATH
, run the following command, replacing /usr/local/bin
with the path that you want to use. Do not add databricks
to the end of this path. For example:
Bash
export PATH="/usr/local/bin:$PATH"
To verify that the PATH
was set correctly for the current terminal session, run databricks
followed by -v
and check the version number:
To have the PATH
set this way every time you restart your terminal, add the command from step 3 to your shell initialization file. For example, for Zshell, this file is typically located at ~/.zshrc
. For Bash, this file is typically located at ~/.bashrc
. For other shells, see your shell provider's documentation.
After you update your shell initialization file, you must restart your terminal to apply the updated PATH
value.
Right-click the installation of databricks
that you want to use without prepending the full path to each and every call to the CLI.
Click Open file location.
Note the path to databricks
, for example C:\Windows
.
On the Start menu, search for Environment variables.
Click Edit environment variables for your account.
Select the Path variable in the User variables for <username>
section.
Click Edit.
Click New.
Enter the path that you want to add, without databricks.exe
(such as C:\Windows
).
Use the Move Up button to move the path that you just added to the beginning of the list.
Click OK.
To verify that the PATH
was set correctly, open a new Command Prompt, run databricks
followed by -v
, and check the version number:
The legacy CLI and the new CLI both support Databricks personal access token authentication. However, Databricks recommends that you use other Databricks authentication types if possible, which only the new CLI supports.
If you must use Databricks personal access token authentication, Databricks recommends that you use one that is associated with a service principal instead of a Databricks account or workspace user. See Service principals.
The new CLI supports OAuth tokens in addition to Databricks personal access tokens. These additional tokens are more secure as they typically expire in one hour, whereas Databricks personal access tokens can be valid from one day up to indefinitely. This is especially important if a token is accidentally checked into version control systems that can be accessed by others. Also, the new CLI can automatically refresh these additional tokens when they expire, whereas refreshing Databricks personal access tokens is either a manual process or can be difficult to automate.
For more information, see Authentication for the Databricks CLI.
Command group and command comparisonsâThe following table lists the legacy CLI command groups and their new CLI command group equivalents. Where significant differences exist between CLIs, additional tables list legacy CLI commands or options and their new CLI command or option equivalents.
Command groupsâconfigure
optionsâ fs
commandsâ
All fs
commands in the legacy CLI are the same in the new CLI, except for fs mv
which is not available in the new CLI.
groups
commandsâ pipelines
commandsâ runs
commandsâ secrets
commandsâ tokens
commandsâ unity-catalog
command groupsâ
unity-catalog <command>
in the legacy CLI becomes just <command>
in the new CLI.
workspace
commandsâ Default and positional argumentsâ
Most of the new CLI commands have at least one default argument that does not have an accompanying option. Some new CLI commands have two or more positional arguments that must be specified in a particular order and that do not have accompanying options. This is different from the legacy CLI, where most commands require options to be specified for all arguments. For example, the new CLI's clusters get
command takes a cluster ID as a default argument. However, the legacy CLI's clusers get
command requires you to specify a --cluster-id
option along with the cluster ID. For example:
For the legacy CLI:
Bash
databricks clusters get --cluster-id 1234-567890-a1b23c4d
databricks clusters get 1234-567890-a1b23c4d
For the new CLI:
Bash
databricks clusters get 1234-567890-a1b23c4d
databricks clusters get --cluster-id 1234-567890-a1b23c4d
As another example, the new CLI's grants get
command takes two default arguments: the securable type followed by the securable's full name. However, the legacy CLI's unity-catalog permissions get
command requires you to specify a --<securable-type>
option along with the securable's full name. For example:
For the legacy CLI:
Bash
databricks unity-catalog permissions get --schema main.default
For the new CLI:
Bash
databricks grants get schema main.default
databricks grants get --schema main.default
Debug modeâ
The legacy CLI provides a --debug
option to show full stack trace on error. For the new CLI, the --debug
option is not recognized. Instead, use the following options:
--log-file <path>
to write log information to the file specified in <path>
. If this option is not provided, log information is output to stderr. Specifying --log-file
without also specifying --log-level
results in no log information being written to the file.--log-format <type>
to specify the format of the information logged. <type>
can be text
(the default, if not specified) or json
.--log-level <format>
to specify the level of information logged. Allowed values are disabled
(the default, if not specified), trace
, debug
, info
, warn
, and error
.For the legacy CLI, the following example shows the full stack trace on error:
Bash
databricks fs ls / --debug
For the new CLI, the following example logs the full stack trace to a file named new-cli-errors.log
in the current working directory. The stack trace is written to the file in JSON format:
Bash
databricks fs ls / --log-file new-cli-errors.log --log-format json --log-level trace
Common questionsâ
This section lists common questions about migrating from the legacy to the new CLI.
What is happening to the legacy CLI?âThe legacy CLI is still available but is not receiving any non-critical updates. The legacy CLI documentation reflects this. Databricks recommends that users migrate to the new CLI as soon as possible.
The legacy CLI has always been in an Experimental state with a disclaimer that Databricks plans no new feature work for the legacy CLI, and the legacy CLI is not supported through Databricks support channels.
When will the legacy CLI be deprecated?âThe legacy CLI has always been in an Experimental state with a disclaimer that Databricks plans no new feature work for the legacy CLI, and the legacy CLI is not supported through Databricks support channels.
Databricks has not established a date or timeline for deprecating the legacy CLI. However, Databricks recommends that users migrate to the new CLI as soon as possible.
When will the new CLI be released as generally available (GA)?âA release date or timeline for releasing the new CLI as GA has not been established. This will depend on feedback that Databricks receives from users during the Public Preview.
What are the key differences between the legacy and new CLIs?âThe new CLI has coverage for almost all of the commands from the legacy CLI. However, notably absent from the new CLI is the stacks
command group in the legacy CLI. Also, a few legacy CLI command groups such as unity-catalog
and runs
have been refactored into new command groups in the new CLI. For migration guidance, see the information provided earlier in this article.
For migration guidance, see the information provided earlier in this article. Note that the new CLI is not a drop-in replacement for the legacy CLI and requires some setup to move from the legacy to the new CLI.
Can installations of the legacy and new CLIs exist on the same machine?âYes. Installations of the legacy and new CLIs can exist on the same machine, but they must be located in different directories. Because the executables are both named databricks
, you must control which executable is run by default by configuring your machine's PATH
. If you want to run the new CLI but somehow accidentally run the legacy CLI instead, by default the legacy CLI will run the new CLI with the same arguments and show the following warning message:
Databricks CLI <new-version-number> found at <new-path>
Your current PATH prefers running CLI <old-version-number> at <old-path>
Because both are installed and available in PATH,
I assume you are trying to run the newer version.
If you want to disable this behavior you can set DATABRICKS_CLI_DO_NOT_EXECUTE_NEWER_VERSION=1.
Executing CLI <new-version-number>...
-------------------------------------
Databricks CLI <new-version-number>
As shown in the preceding warning message, you can set the DATABRICKS_CLI_DO_NOT_EXECUTE_NEWER_VERSION
environment variable to 1
to disable this behavior and run the legacy CLI instead.
To get help with migrating from the legacy CLI to the new CLI, see the following resources:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4