Databricks-cli is used for the Databricks administration. With it, we can manage the following items:
- Clusters: Utility to interact with Databricks clusters.
- Configure: Configures host and authentication info for the CLI.
- Fs: Utility to interact with DBFS.
- Groups: Utility to interact with Databricks groups.
- Jobs: Utility to interact with jobs.
- Libraries: Utility to interact with libraries.
- Runs: Utility to interact with the jobs runs.
- Secrets: Utility to interact with Databricks secret API.
- Stack: Utility to deploy and download Databricks resource stacks.
- Workspace : Utility to interact with the Databricks workspace.
The remainder of this page will describe how to setup Databricks-cli.
Requirements
We need an access to a Databricks workspace’s token. Also, Python has to be installed on the developer’s PC.
Python installation
From https://www.python.org/downloads/windows/, download the latest Windows version as shown in the following screenshot. You can opt for the web or full installer, One or the other doesn’t matter.
Once the setup starts, you’ll get the following screen (the Python version may differ).
Make sure that the two checkboxes are selected :
- Install launcher for all users
- Add Python to PATH
Once the installation completes, go to the environment variables of your PC:
Click on environment variables
Select Path in the “User variables” (upper window) and click on “Edit” as highlighted below.
Click on New as shown below
Enter the following string:
%USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts
And click on OK in both windows to save the path as shown below.
Open a command window and type the following command:
pip3 install databricks-cli
The installation will go on. At the end of it. Open to the %USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts folder and you should see “Databricks.exe” as shown in the following screenshot.
Now, back to the command window, type the following command:
databricks --version
The version of databricks should now be displayed as shown below.
We’re now ready to configure databricks-cli.
Databricks-cli configuration
Once databricks-cli is installed, we have to connect to an existing Databricks workspace. In order to do so, we’ll use the following command:
databricks configure --token
as shown in the following screenshot.
The Databricks host is where Azure region where the workspace has been created; in our case, East US. The token can be obtained from the workspace itself. Here’s the procedure to do it. Open the Databricks workspace you want to link to the databricks-cli and follow this link to create the token for the workspace.
Leave a Reply