Add serverless code runner tool (Python, SQL, .ipynb — no cluster required)#278
Draft
GeorgeTheo99 wants to merge 3 commits intodatabricks-solutions:mainfrom
Draft
Add serverless code runner tool (Python, SQL, .ipynb — no cluster required)#278GeorgeTheo99 wants to merge 3 commits intodatabricks-solutions:mainfrom
GeorgeTheo99 wants to merge 3 commits intodatabricks-solutions:mainfrom
Conversation
Adds a new `run_code_on_serverless()` function that executes Python or SQL code on Databricks serverless compute using the Jobs API `runs/submit` endpoint. No interactive cluster is required. The implementation: - Uploads code as a temporary notebook to the workspace - Submits a one-time run with serverless compute (environments + environment_key pattern) - Waits for completion and retrieves output via get_run_output - Cleans up temporary workspace files after execution - Returns a typed ServerlessRunResult with output, error, run_id, run_url, and timing New files and changes: - databricks-tools-core: compute/serverless.py (core module) - databricks-tools-core: compute/__init__.py (exports) - databricks-mcp-server: tools/compute.py (MCP tool wrapper) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… improve docs - Retrieve actual Python traceback on failure instead of generic "Workload failed" message by fetching run output in the exception handler - Fix Optional[str] type annotation for run_name in MCP wrapper - Document SQL SELECT output limitation in all docstrings - Reframe tool as Python-first; clarify SQL is niche (DDL/DML only, use execute_sql for queries — works with serverless SQL warehouses) - Add databricks-serverless-compute skill file with decision matrix, output capture behavior, limitations, and examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Auto-detects .ipynb JSON content and uploads via Databricks native Jupyter import (ImportFormat.JUPYTER), enabling users to run local Jupyter notebooks on serverless compute without conversion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_code_on_serverless— Execute Python, SQL, or Jupyter notebooks (.ipynb) on Databricks serverless compute via the Jobs API (runs/submit). No cluster required..ipynbcontent and uploads via Databricks' native Jupyter import (ImportFormat.JUPYTER) — a net-new capability for the toolkit.Files changed (4 files, +619 lines)
databricks-tools-core/.../compute/serverless.pydatabricks-tools-core/.../compute/__init__.pydatabricks-mcp-server/.../tools/compute.pydatabricks-skills/.../SKILL.mdKey design decisions
runs/submit(notjobs.create) — ephemeral one-time runs, no stale job definitions left behindexecute_sql()instead.ipynbdetection is content-based (checks for"cells"key in JSON), no file extension neededTest plan
🤖 Generated with Claude Code