- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2025 05:20 AM
Hello Guyz,
Someone Know what's is the best pratices to setup databricks connect for Pycharm and VsCode using Docker, Justfile and .env file
Cordially,
Seefoods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2025 09:53 AM - edited 12-07-2025 09:55 AM
Hi @seefoods!
I’ve worked with Databricks Connect and VSCode in different projects, and although your question mentions Docker, Justfile and .env, the “best practices” really depend on what you’re trying to do. Here’s what has worked best for me:
1.- Databricks Connect → for local development inside VSCode
I mainly use Databricks Connect to:
- run Spark code locally
- get autocompletion and type hints
- debug transformations
- quickly test code before sending it to a Databricks cluster
It’s perfect for the development loop inside VSCode.
2.- Databricks VSCode extension → for running real workloads on Databricks
For me, this is the cleanest workflow when you want to run things on the platform:
- run scripts/notebooks on a cluster
- browse catalogs, tables, repos
- switch profiles
- see job logs and outputs
So the combination works really well:
Databricks Connect → local dev experience
VSCode extension → execute remotely on Databricks
3.- Use .databrickscfg for VSCode authentication
What is the Databricks extension for Visual Studio Code?
The Databricks VSCode extension expects credentials in: ~/.databrickscfg
[DEFAULT]
host = https://<workspace-url>
token = <PAT> Or multiple profiles:
[dev]
host = https://dev-workspace
token = <token-dev>
[prod]
host = https://prod-workspace
token = <token-prod> 4.- When building external services (FastAPI, Uvicorn, etc.), .env is useful
For microservices calling Databricks Model Serving, I do use .env, for example:
DATABRICKS_HOST=https://<workspace-url>
DATABRICKS_TOKEN=<token>
MODEL_SERVING_ENDPOINT=/serving-endpoints/my-model/invocations 1) Use --env-file directly with Uvicorn (supported natively). This works perfectly inside a Justfile:
run:
uvicorn app.main:app --host 0.0.0.0 --port 8080 --env-file .env from dotenv import load_dotenv
import os
load_dotenv()
host = os.getenv("DATABRICKS_HOST")
token = os.getenv("DATABRICKS_TOKEN")
endpoint = os.getenv("MODEL_SERVING_ENDPOINT") run:
uvicorn app.main:app --host 0.0.0.0 --port 8080
At the end of the day, both approaches are valid and in my experience, which one you use really depends on the specific use case. For local development and running things directly on Databricks, I prefer the VSCode plugin + .databrickscfg. For external services (FastAPI, Uvicorn, Justfile deployments), .env works perfectly.
So depending on what you want to build, you will naturally choose one approach or the other.
Hope it helps!
Gema 👩💻
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2025 06:40 AM