You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,9 +28,20 @@ Before we get started, you'll need to have the following tools:
24
28
25
29
## Step 1: Create Cluster
26
30
31
+
The first step is to create a cluster in your Databricks workspace. That will be used to run your notebooks both in the workspace and locally.
32
+
33
+
1. Open your Databricks Portal and navigate to the `Compute` tab.
34
+
2. Click on `Create Compute` to create a new cluster.
35
+
3. Select runtime version >= 15 and configuration for your cluster. You can use the default settings for now.
36
+
4. Click on `Create Compute` and wait for the cluster to be up.
37
+
38
+
After this step, you should have a new cluster running in your workspace.
39
+
40
+
<Imagesrc={ImgNewCluster} />
41
+
27
42
## Step 2: Create Databricks Local Profile
28
43
29
-
The first step is to connect your Databricks workspace to your local machine and storing the connection details in a local profile. This will allow Databricks Extension for VSCode to connect to your workspace.
44
+
In this step, we'll connect your Databricks workspace to your local machine and storing the connection details in a local profile. This will allow Databricks Extension for VSCode to connect to your workspace.
30
45
31
46
1. Install Databricks CLi by running one of the following commands:
32
47
@@ -57,7 +72,7 @@ The first step is to connect your Databricks workspace to your local machine and
Follows the prompts to log in and configure the cluster. After this step, you should be able to see the a DEFAULT PROFILE in `~/.databrickscfg` file.
75
+
Follows the prompts to log in and configure the cluster. After this step, you should be able to see the a profile in `~/.databrickscfg` file.
61
76
62
77
## Step 3: Create Python Environment with Mini Conda
63
78
@@ -124,6 +139,8 @@ Mini Conda is a lightweight version of Anaconda that allows you to create and ma
124
139
pip install databricks-connect
125
140
```
126
141
142
+
After this step, you should have a new python environment with `databricks-connect` installed.
143
+
127
144
## Step 4: Run notebooks locally
128
145
129
146
Now that we have our Databricks profile set up and a python environment ready, we can start working on our notebooks locally.
@@ -145,15 +162,21 @@ Now that we have our Databricks profile set up and a python environment ready, w
145
162
146
163
Now you should be able to see the Databricks icon in the sidebar of your VSCode.
147
164
148
-
3. Click on the Databricks icon in the sidebar and select `Configure Databricks`, then select `DEFAULT` profile we created in step 1.
165
+
3. Click on the Databricks icon in the sidebar and select `Configure Databricks`, then select the profile we created in step 1.
149
166
150
167
<Imagesrc={ImgSelectProfile} />
151
168
152
-
After this step, Databricks extension will create a folder ... as the destination for our folder.
169
+
You can also enable sync, Databricks extension will push all the files in the local folder to the Databricks workspace.
153
170
154
171
**PLEASE NOTE THAT THIS IS ONE-WAY SYNC, ANY CHANGES MADE IN THE DATABRICKS WORKSPACE WILL NOT BE REFLECTED IN THE LOCAL FOLDER**.
155
172
156
-
4. Now you can create a new notebook for testing connection. Let's create a new notebook named `test.py` and add the following code:
173
+
4. Also on the Databricks extension, click on `Configure cluster` and select the cluster we created in step 1. Don't forget to make sure the cluster is running.
174
+
175
+
<Imagesrc={ImgConfigureCluster} />
176
+
177
+
5. Install Jupyter extension for VSCode to run the notebook. Visit [this link](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) and click on `Install`.
178
+
179
+
6. Now you can create a new notebook for testing connection. Let's create a new notebook named `test.py` and add the following code:
157
180
158
181
```python
159
182
# COMMAND ----------
@@ -164,7 +187,13 @@ Now that we have our Databricks profile set up and a python environment ready, w
164
187
165
188
Don't forget include the `# COMMAND ----------` at the beginning of the cell and `from databricks.sdk.runtime import *` to import the necessary libraries.
166
189
167
-
Run the cell and you should see the output in the output cell.
190
+
7. Open the command palette in VSCode by pressing `Ctrl + Shift + P` or `Cmd + Shift + P` and search for `Python: Select Interpreter`. Select the `dbr` environment we created in step 3.
191
+
192
+
<Imagesrc={ImgSelectEnv} />
193
+
194
+
8. Run the notebook by pressing `Shift + Enter` or clicking on the `Run Cell` button and you should see the output in the output panel.
0 commit comments