Querymaster databricks

From CarlosCaPe/octorato · View interactive version

Querymaster databricks is an AI agent skill from the GitHub repository CarlosCaPe/octorato. Child skill of querymaster for Databricks. PLACEHOLDER: no workspace or cluster provisioned yet, only the connection template with databricks-sql-connector. Completed once access exists.

How to use this skill

Skill file

QueryMaster — Databricks Engine Skill (Placeholder)

Child skill of querymaster. Activated when engine is Databricks.

Status: PLACEHOLDER — No active workspace/cluster available yet.

This skill will be completed when Databricks access is provisioned.

Connection Patterns (Template)

Python (databricks-sql-connector)

from databricks import sql

conn = sql.connect(
    server_hostname=env["DATABRICKS_HOST"],       # adb-xxxx.azuredatabricks.net
    http_path=env["DATABRICKS_HTTP_PATH"],         # /sql/1.0/warehouses/xxxx
    access_token=env["DATABRICKS_TOKEN"],          # PAT or OAuth token
)
cursor = conn.cursor()
cursor.execute("SELECT 1")

Python — OAuth (Azure AD)

from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
token = credential.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default")  # Databricks resource ID

conn = sql.connect(
    server_hostname=env["DATABRICKS_HOST"],
    http_path=env["DATABRICKS_HTTP_PATH"],
    credentials_provider=lambda: {"Authorization": f"Bearer {token.token}"},
)

connections.json entry (template)

{
  "databricks_dev": {
    "engine": "databricks",
    "auth": "pat",
    "env_file": "~/Documents/github/PROJECT/.env",
    "env_vars": {
      "host": "DATABRICKS_HOST",
      "http_path": "DATABRICKS_HTTP_PATH",
      "token": "DATABRICKS_TOKEN"
    }
  }
}

.env template

DATABRICKS_HOST=adb-1234567890.azuredatabricks.net
DATABRICKS_HTTP_PATH=/sql/1.0/warehouses/abcdef1234567890
DATABRICKS_TOKEN=dapi<YOUR_PERSONAL_ACCESS_TOKEN_HERE>

Key Concepts

Compute Types

Unity Catalog Hierarchy

Catalog → Schema (Database) → Table/View/Function

Delta Lake

Schema Discovery Queries (Template)

-- List catalogs
SHOW CATALOGS;

-- List schemas in catalog
SHOW SCHEMAS IN catalog_name;

-- List tables in schema
SHOW TABLES IN catalog_name.schema_name;

-- Table details
DESCRIBE TABLE EXTENDED catalog.schema.table;

-- Column details
DESCRIBE catalog.schema.table;

-- Table history (Delta)
DESCRIBE HISTORY catalog.schema.table;

-- Table properties
SHOW TBLPROPERTIES catalog.schema.table;

-- Compute resources
-- (not queryable via SQL — use REST API or CLI)

Safety Guards

TODO When Access Is Available

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.