Skip to main content

How can I develop locally with Databricks?

Summary

  • You develop locally with Databricks by keeping your editor, Git workflow and tests on your machine while code runs on Databricks compute. The right tool depends on how much of your environment you want to move onto that compute.
  • The Databricks SSH tunnel, in Beta, connects Visual Studio Code, Cursor or your terminal to serverless compute, AI Runtime or a dedicated classic cluster, so Python, the kernel and execution all run on Databricks.
  • Databricks Connect keeps general code on your machine and runs Spark DataFrame operations and UDFs on Databricks compute, which suits interactive debugging in any IDE.
  • The Databricks IDE extension for Visual Studio Code and Cursor runs local files on Databricks compute or as Lakeflow Jobs, and works with Declarative Automation Bundles.
  • Ship what you build with the Databricks CLI and Declarative Automation Bundles, which define jobs, pipelines and other resources as source files you can test and deploy through CI/CD.

How can I develop locally with Databricks?

Write code in your own IDE and run it on Databricks compute. Databricks gives you four main ways to do that: the SSH tunnel (Beta), which moves your whole development environment onto Databricks compute; Databricks Connect, which runs Spark code remotely while the rest stays local; the Databricks IDE extension for Visual Studio Code and Cursor; and the Databricks CLI with Declarative Automation Bundles for deployment. Pick based on where you want your code to execute.

What "local development" means on Databricks

Your data and compute stay in Databricks. What changes is where each part of your code runs. With Databricks Connect, Python runs on your laptop and Spark plans run on the cluster. With the SSH tunnel, the interpreter, kernel and execution all run remotely, and your local IDE is the front end. That split decides how dependencies, debugging and file persistence behave.

Options for local development

Tool Where your code runs Best for
SSH tunnel (Beta) Python environment, kernel and execution on serverless compute, AI Runtime or a dedicated classic cluster IDE-driven development in the same environment as your compute
Databricks Connect (Python, R, Scala) General code locally; DataFrame operations and UDFs on Databricks compute Interactive debugging with your IDE's native tools, and embedding Spark in applications
Databricks IDE extension Local files run on clusters or serverless compute, or as Lakeflow Jobs Running, debugging and syncing code, and working with bundles from Visual Studio Code or Cursor
Databricks CLI and bundles Resources defined as source files and deployed to your workspaces Team projects, testing and CI/CD
Genie Code CLI (Beta) A coding agent in your local terminal that reaches Databricks through the CLI Agent-assisted work on local files that also touches Unity Catalog data

PyCharm users can also install the PyCharm Databricks plugin, and any other IDE can use the Databricks CLI with Databricks Connect.

SSH tunnel or Databricks Connect?

The docs draw the line clearly. Databricks Connect lets you write code with Spark APIs and run it on Databricks compute instead of a local Spark session, and the Visual Studio Code extension uses it for built-in debugging. The SSH tunnel "moves your entire development environment onto the compute," so Python, the kernel and code execution run on Databricks with access to the compute's resources. Choose Databricks Connect when you want local execution with remote Spark. Choose the SSH tunnel when you want to run code in the same environment as your cluster or serverless compute.
One caution: the SSH tunnel and the Databricks IDE extension aren't compatible yet, so don't use them together.

Getting started with the SSH tunnel

Start from your local machine. You need the Databricks CLI version 1.5.0 or above with authentication configured, plus Visual Studio Code with the Remote - SSH extension or Cursor. Then:

  • Serverless compute: run databricks ssh connect from your terminal. Add --ide vscode or --ide cursor to open the editor connected to remote compute. Port forwarding to serverless compute must be enabled.
  • Dedicated classic compute: run databricks ssh setup --name <connection-name> to add a reusable SSH host entry, then connect from your IDE or with ssh <connection-name>. The cluster must run Databricks Runtime 17.0 or above with Unity Catalog enabled. Shared clusters aren't supported.

After connecting, open /Workspace/Users/<your-username> and select the session's Python environment. Files in /Workspace, /Volumes and /dbfs persist across cluster restarts; files in other local paths don't. The tunnel carries traffic over HTTPS with WebSocket support to your workspace domain, so it doesn't need port 22.

Shipping what you build locally

Local development ends in a deploy. Declarative Automation Bundles describe jobs, pipelines, dashboards, Model Serving endpoints and MLflow resources as source files alongside your code. Run databricks bundle init to start from a template, then validate, deploy and run the bundle with the Databricks CLI. Bundles can run from IDEs, terminals or inside Databricks, so the same project works in CI/CD.

FAQs

Do I need a running cluster to develop locally?

Not always. The SSH tunnel connects directly to serverless compute with databricks ssh connect, and Databricks Connect has a serverless tutorial. SSH tunnel connections to classic compute need a dedicated, single-user cluster.

Which IDEs does the SSH tunnel support?

Visual Studio Code and Cursor are officially supported and tested. The docs say any IDE with SSH capabilities is compatible, and they include setup steps for IntelliJ IDEs.

Can I use a coding agent while I develop locally?

Yes. Genie Code CLI (Beta) runs in your local terminal or any IDE's integrated terminal. It doesn't support SSH tunnel sessions, so run it on your local machine.

Is the SSH tunnel generally available?

No. It's in Beta, and Databricks notes that cost and pricing for Beta features are subject to change.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.