thomazrossito/data-agents/databricks-app-python
Claude Code and agent skill by thomazrossito/data-agents
- community
Checking that the SKILL.md file is still in the repository.
Builds Python-based Databricks applications using Dash, Streamlit, Gradio, Flask, FastAPI, or Reflex. Handles OAuth authorization (app and user auth), app resources, SQL warehouse and Lakebase connectivity, model serving integration, foundation model APIs, LLM integration, and deployment. Use when building Python web apps, dashboards, ML demos, or REST APIs for Databricks, or when the user mentions Streamlit, Dash, Gradio, Flask, FastAPI, Reflex, or Databricks app.
Install
npx vskill@latest install thomazrossito/data-agents/databricks-app-pythonSKILL.md
The same SKILL.md was published earlier as thomazrossito/data-agents/databricks-app-python.
Databricks Python Application
Build Python-based Databricks applications. For full examples and recipes, see the [Databricks Apps Cookbook](https://apps-cookbook.dev/).
Critical Rules (always follow)
- MUST confirm framework choice or use Framework Selection below
- MUST use SDK
Config()for authentication (never hardcode tokens) - MUST use
app.yamlvalueFromfor resources (never hardcode resource IDs) - MUST use
dash-bootstrap-componentsfor Dash app layout and styling - MUST use
@st.cache_resourcefor Streamlit database connections - MUST deploy Flask with Gunicorn, FastAPI with uvicorn (not dev servers)
Required Steps
Copy this checklist and verify each item:
Framework Selection
| Framework | Best For | app.yaml Command | |
|---|---|---|---|
| Dash | Production dashboards, BI tools, complex interactivity | ["python", "app.py"] | |
| Streamlit | Rapid prototyping, data science apps, internal tools | ["streamlit", "run", "app.py"] | |
| Gradio | ML demos, model interfaces, chat UIs | ["python", "app.py"] | |
| Flask | Custom REST APIs, lightweight apps, webhooks | ["gunicorn", "app:app", "-w", "4", "-b", "0.0.0.0:8000"] | |
| FastAPI | Async APIs, auto-generated OpenAPI docs | ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |
| Reflex | Full-stack Python apps without JavaScript | ["reflex", "run", "--env", "prod"] |
Default: Recommend Streamlit for prototypes, Dash for production dashboards, FastAPI for APIs, Gradio for ML demos.
Quick Reference
| Concept | Details | |
|---|---|---|
| Runtime | Python 3.11, Ubuntu 22.04, 2 vCPU, 6 GB RAM | |
| Pre-installed | Dash 2.18.1, Streamlit 1.38.0, Gradio 4.44.0, Flask 3.0.3, FastAPI 0.115.0 | |
| Auth (app) | Service principal via Config() — auto-injected DATABRICKS_CLIENT_ID/DATABRICKS_CLIENT_SECRET | |
| Auth (user) | x-forwarded-access-token header — see 1-authorization.md | |
| Resources | valueFrom in app.yaml — see 2-app-resources.md | |
| Cookbook | https://apps-cookbook.dev/ | |
| Docs | https://docs.databricks.com/aws/en/dev-tools/databricks-apps/ |
Detailed Guides
Authorization: Use 1-authorization.md when configuring app or user authorization — covers service principal auth, on-behalf-of user tokens, OAuth scopes, and per-framework code examples. (Keywords: OAuth, service principal, user auth, on-behalf-of, access token, scopes)
App resources: Use 2-app-resources.md when connecting your app to Databricks resources — covers SQL warehouses, Lakebase, model serving, secrets, volumes, and the valueFrom pattern. (Keywords: resources, valueFrom, SQL warehouse, model serving, secrets, volumes, connections)
Frameworks: See 3-frameworks.md for Databricks-specific patterns per framework — covers Dash, Streamlit, Gradio, Flask, FastAPI, and Reflex with auth integration, deployment commands, and Cookbook links. (Keywords: Dash, Streamlit, Gradio, Flask, FastAPI, Reflex, framework selection)
Deployment: Use 4-deployment.md when deploying your app — covers Databricks CLI, Asset Bundles (DABs), app.yaml configuration, and post-deployment verification. (Keywords: deploy, CLI, DABs, asset bundles, app.yaml, logs)
Lakebase: Use 5-lakebase.md when using Lakebase (PostgreSQL) as your app's data layer — covers auto-injected env vars, psycopg2/asyncpg patterns, and when to choose Lakebase vs SQL warehouse. (Keywords: Lakebase, PostgreSQL, psycopg2, asyncpg, transactional, PGHOST)
MCP tools: Use 6-mcp-approach.md for managing app lifecycle via MCP tools — covers creating, deploying, monitoring, and deleting apps programmatically. (Keywords: MCP, create app, deploy app, app logs)
Foundation Models: See examples/llm_config.py for calling Databricks foundation model APIs — covers OAuth M2M auth, OpenAI-compatible client wiring, and token caching. (Keywords: foundation model, LLM, OpenAI client, chat completions)
Workflow
- Determine the task type:
New app from scratch? → Use Framework Selection, then read 3-frameworks.md Setting up authorization? → Read 1-authorization.md Connecting to data/resources? → Read 2-app-resources.md Using Lakebase (PostgreSQL)? → Read 5-lakebase.md Deploying to Databricks? → Read 4-deployment.md Using MCP tools? → Read 6-mcp-approach.md Calling foundation model/LLM APIs? → See examples/llm_config.py
- Follow the instructions in the relevant guide
- For full code examples, browse https://apps-cookbook.dev/
Core Architecture
All Python Databricks apps follow this pattern:
Backend Toggle Pattern
SQL Warehouse Connection (shared across all frameworks)
Pydantic Models
Common Issues
| Issue | Solution | |
|---|---|---|
| Connection exhausted | Use @st.cache_resource (Streamlit) or connection pooling | |
| Auth token not found | Check x-forwarded-access-token header — only available when deployed, not locally | |
| App won't start | Check app.yaml command matches framework; check databricks apps logs <name> | |
| Resource not accessible | Add resource via UI, verify SP has permissions, use valueFrom in app.yaml | |
| Import error on deploy | Add missing packages to requirements.txt (pre-installed packages don't need listing) | |
| Lakebase app crashes on start | psycopg2/asyncpg are NOT pre-installed — MUST add to requirements.txt | |
| Port conflict | Apps must bind to DATABRICKS_APP_PORT env var (defaults to 8000). Never use 8080. Streamlit is auto-configured; for others, read the env var in code or use 8000 in app.yaml command | |
| Streamlit: set_page_config error | st.set_page_config() must be the first Streamlit command | |
| Dash: unstyled layout | Add dash-bootstrap-components; use dbc.themes.BOOTSTRAP | |
| Slow queries | Use Lakebase for transactional/low-latency; SQL warehouse for analytical queries |
Platform Constraints
| Constraint | Details | |
|---|---|---|
| Runtime | Python 3.11, Ubuntu 22.04 LTS | |
| Compute | 2 vCPUs, 6 GB memory (default) | |
| Pre-installed frameworks | Dash, Streamlit, Gradio, Flask, FastAPI, Shiny | |
| Custom packages | Add to requirements.txt in app root | |
| Network | Apps can reach Databricks APIs; external access depends on workspace config | |
| User auth | Public Preview — workspace admin must enable before adding scopes |
Official Documentation
- [Databricks Apps Overview](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/) — main docs hub
- [Apps Cookbook](https://apps-cookbook.dev/) — ready-to-use code snippets (Streamlit, Dash, Reflex, FastAPI)
- [Authorization](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/auth) — app auth and user auth
- [Resources](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/resources) — SQL warehouse, Lakebase, serving, secrets
- [app.yaml Reference](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/app-runtime) — command and env config
- [System Environment](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/system-env) — pre-installed packages, runtime details
Related Skills
- [databricks-app-apx](../databricks-app-apx/SKILL.md) - full-stack apps with FastAPI + React
- [databricks-bundles](../databricks-bundles/SKILL.md) - deploying apps via DABs
- [databricks-python-sdk](../databricks-python-sdk/SKILL.md) - backend SDK integration
- [databricks-lakebase-provisioned](../databricks-lakebase-provisioned/SKILL.md) - adding persistent PostgreSQL state
- [databricks-model-serving](../databricks-model-serving/SKILL.md) - serving ML models for app integration
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/databricks/databricks-app-python/SKILL.md
Popularity
- Repository stars
- 30
- Repository forks
- 20
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thomazrossito/data-agents/databricks-app-python)