databricks-sdk-patterns

Featured

Apply production-ready Databricks SDK patterns for Python and REST API. Use when implementing Databricks integrations, refactoring SDK usage, or establishing team coding standards for Databricks. Trigger with phrases like "databricks SDK patterns", "databricks best practices", "databricks code patterns", "idiomatic databricks".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Databricks SDK Patterns ## Overview Production-ready patterns for the Databricks Python SDK (`databricks-sdk`). Covers singleton client initialization, typed error handling, cluster lifecycle management, type-safe job construction, and pagination. Uses real SDK exception classes and API shapes. ## Prerequisites - `databricks-sdk>=0.20.0` installed - Authentication configured (see `databricks-install-auth`) - Python 3.10+ ## Instructions ### Step 1: Singleton Client with Profile Support Each `WorkspaceClient` holds an HTTP session and re-authenticates. Cache instances. ```python from databricks.sdk import WorkspaceClient, AccountClient from functools import lru_cache @lru_cache(maxsize=4) def get_client(profile: str = "DEFAULT") -> WorkspaceClient: """Cached WorkspaceClient — one per profile.""" return WorkspaceClient(profile=profile) @lru_cache(maxsize=1) def get_account_client() -> AccountClient: """Account-level client for multi-workspace operations.""" return AccountClient( host="https://accounts.cloud.databricks.com", account_id="00000000-0000-0000-0000-000000000000", ) # Usage w = get_client() w_prod = get_client("production") ``` ### Step 2: Structured Error Handling The SDK raises typed exceptions from `databricks.sdk.errors`. Distinguish transient (retryable) from permanent failures. ```python from dataclasses import dataclass from typing import TypeVar, Generic, Optional, Callable from databricks.sdk.errors import ( ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category