In this lecture. I’ll help you set up the databricks CLI and install it on your machine.
So Mac users open up your terminal and Windows users open up your command prompt.
So first you need to run
Pip install databricks hyphen cli
This will install the library.
To check that it’s installed properly.
Type databricks hyphen hyphen version.
And as you can see, this is my current version.
Okay, so we’ve installed it and now we need to set it up so that it’s authenticated against our databricks
environment.
So type the following Databricks.
Configure.
Token.
So.
Hyphen.
Hyphen.
Token.
Databricks.
Configure hyphen hyphen.
Token and press enter.
It will then ask you for your databricks host URL.
This is the URL of your databricks workspace.
So.
The Databricks workspace URL is everything.
Up to and including dot net.
So everything after this slash can be excluded.
So copy this.
Go back to your terminal and paste in the URL and you can remove the slash if you’ve accidentally copied
that and press enter.
It will now ask you for a token, as you can see here, so we can quickly set this up.
This is asking specifically for a personal access token.
In Databricks.
A personal access token is a secure authentication mechanism used to access the Databricks environment.
It’s a string of characters that serves as a credential granting permissions to perform actions or to
retrieve information from a databricks workspace.
To generate a personal access token, go to user settings.
And then here you can see access tokens and click on Generate New Token.
This token is specific to my user account.
Different users can generate different tokens.
So give the token a name in the comment.
So I’ll just say databricks cli because that’s what I’m using it for and give it a lifetime.
Give it a lifetime amount in days.
So as you can see, you can keep it indefinitely if you want, but I’ll just keep the default of 90
days and then click on Generate.
What this will do is it will generate the token.
Make sure you copy this because once you click done, you won’t be able to access it again.
Back in your terminal.
Paste that in.
And when you do, you won’t be able to see the value.
Don’t worry about that.
Just press enter.
And now that seems to have worked.
So behind the scenes, what’s happened is when you’ve provided this token and you’ve configured the
access, using that token, your credentials are stored in a file in your system, so you won’t need
to enter this information again.
But if you need to change your token, you can type databricks, configure token again and go through
the same process.
So to confirm this is working, we can just type databricks.
Foster’s list.
And now, as you can see, I’ve got a list of all of the clusters that I’ve used.
The majority of these are job clusters.
However, this cluster is the compute cluster that I created.
So as you can see, this is working.
We’ve installed the Databricks CLI and we’ve authenticated it using a personal access token to our databricks
environment and we’ve confirmed it’s working by listing all of the clusters in our databricks workspace.