Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

databricksdatabricks 搜索

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

1,126

周安装

46

GitHub Stars

9

下载量

364
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:databricks(databricks 搜索)
来源仓库:https://github.com/i9wa4/dotfiles
仓库路径:skills/databricks
安装命令:
npx skills add https://github.com/i9wa4/dotfiles --skill databricks
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/i9wa4/dotfiles --skill databricks

简介

提供 Databricks CLI 使用指南与 Warehouse ID 配置方法。

  • 支持 Statements API 查询执行与结果获取。
  • 涵盖认证方式、配置文件管理与作业调度。databricks 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 适用于数据工程师日常查询与任务编排场景。
  • 需正确设置 profile 与 warehouse_id 避免权限错误。

SKILL.md

Databricks Expert Engineer Skill

This skill provides a comprehensive guide for Databricks development.

1. Databricks CLI Usage

1.1. About warehouse_id

  • Find and select one Serverless SQL Warehouse for warehouse_id
  • Note: databricks CLI does not auto-read warehouse_id from config files, so explicitly include it in JSON each time

1.2. Authentication

  • When auth_type=databricks-cli in profile, run U2M authentication first databricks auth login --host https://xxx.cloud.databricks.com --profile PROFILE_NAME
  • Check authentication status databricks auth profiles

1.3. Basic Usage

Statements API (Query Execution)

# Execute query
databricks api post /api/2.0/sql/statements --profile "DEFAULT" --json '{
  "warehouse_id": "xxxxxxxxxx",
  "catalog": "catalog_name",
  "schema": "schema_name",
  "statement": "select * from table_name limit 10"
}'

# Get results (statement_id is returned from execution)
databricks api get /api/2.0/sql/statements/{statement_id} --profile "DEFAULT"

Queries API (Query Object Management)

# Create query object (for dashboards, saved queries)
# IMPORTANT: Use warehouse_id, query_text, display_name (NOT data_source_id, query, name)
databricks api post /api/2.0/sql/queries --profile "DEFAULT" --json '{
  "warehouse_id": "xxxxxxxxxx",
  "display_name": "My Query",
  "query_text": "SELECT * FROM table_name LIMIT 10",
  "description": "Optional description"
}'

# List queries
databricks api get /api/2.0/sql/queries --profile "DEFAULT"

# Get query by ID
databricks api get /api/2.0/sql/queries/{query_id} --profile "DEFAULT"

Common Mistakes:

  • data_source_id → ✅ warehouse_id
  • query → ✅ query_text
  • name → ✅ display_name

1.4. Command Tips

  1. Query execution flow

- post executes query -> returns statement_id - get retrieves results (wait until state is SUCCEEDED) - For long queries, add sleep and retry

  1. Error handling

- state: CLOSED: Result retrieval was too slow. Get earlier - state: FAILED: SQL error. Check error_message - state: RUNNING: Still executing. Wait and retry get - Timeout: For large data, use limit to verify

  1. Reading results

- data_array: Actual data (2D array) - schema.columns: Column names and type info - total_row_count: Total count (shown even with limit) - state: Query execution state

  1. Parameterized queries
databricks api post /api/2.0/sql/statements --profile "DEFAULT" --json '{
  "warehouse_id": "xxxxxxxxxx",
  "statement": "select * from table where date >= :start_date",
  "parameters": [{"name": "start_date", "value": "2025-01-01", "type": "DATE"}]
}'

2. Well-Architected Lakehouse Framework

Consists of 7 pillars:

2.1. Data and AI Governance

Policies and practices to securely manage data and AI assets. Minimize data copies with unified governance solution.

2.2. Interoperability and Usability

Consistent user experience and seamless integration with external systems.

2.3. Operational Excellence

Processes supporting continuous production operations.

2.4. Security, Privacy, and Compliance

Implement safeguards against threats.

2.5. Reliability

Ensure disaster recovery capabilities.

2.6. Performance Efficiency

Adaptability to workload changes.

2.7. Cost Optimization

Cost management to maximize value delivery.

3. Unity Catalog

3.1. Basic Concepts

  • "Define once, secure everywhere" approach
  • Unified access control policies across multiple workspaces
  • ANSI SQL compliant permission management

3.2. Object Model

3-level namespace: catalog.schema.table

  1. Catalog layer: Data isolation unit (by department, etc.)
  2. Schema layer: Logical group containing tables, views, volumes
  3. Object layer: Tables, views, volumes, functions, models

3.3. Permission Management

  • Users cannot access data by default
  • Explicit permission grants required
  • Permissions inherit from parent to child (catalog -> schema -> table)
-- Check permissions
SHOW GRANTS ON SCHEMA main.default;

-- Grant permissions
GRANT CREATE TABLE ON SCHEMA main.default TO `finance-team`;

-- Revoke permissions
REVOKE CREATE TABLE ON SCHEMA main.default FROM `finance-team`;

3.4. Best Practices

  • Managed tables/volumes recommended (Delta Lake format, full lifecycle management)
  • Catalog isolation across workspaces possible
  • Independent managed storage location per catalog recommended

4. Data Engineering

4.1. Lakeflow Solution

Unifies data ingestion, transformation, and orchestration.

  • Lakeflow Connect: Simplifies data ingestion
  • Lakeflow Spark Declarative Pipelines (SDP): Declarative pipeline framework
  • Lakeflow Jobs: Workflow automation

4.2. Delta Lake

  • Parquet data files with file-based transaction log
  • ACID transactions
  • Time travel functionality
  • Optimizations: liquid clustering, data skipping, file layout optimization, vacuum

4.3. Lakeflow Jobs

Task types:

  • Notebook tasks
  • Pipeline tasks
  • Python script tasks

Triggers:

  • Time-based (e.g., daily at 2 AM)
  • Event-based (on new data arrival)

Limits:

  • Workspace: Max 2000 concurrent task executions
  • Saved jobs: Max 12000
  • Tasks per job: Max 1000

5. Machine Learning Infrastructure

5.1. MLflow

  • Core tool for experiment tracking and model management
  • Dedicated features for GenAI

5.2. Feature Store

  • Feature management system
  • Automatic data pipelines and feature discovery

5.3. Model Serving

  • Deploy custom models and LLMs as REST endpoints
  • Auto-scaling and GPU support

6. Security

6.1. Authentication and Access Control

  • SSO configuration
  • Multi-factor authentication
  • Access control lists

6.2. Network Security

  • Private connectivity
  • Serverless egress control
  • Firewall settings
  • VPC management

6.3. Data Encryption

  • Encryption at rest and in transit
  • Customer-managed keys
  • Inter-cluster communication encryption
  • Automatic credential masking

7. SQL Warehouse

7.1. Serverless SQL Warehouse Benefits

  • Instant and elastic compute
  • Auto-scaling
  • Minimal management (Databricks handles capacity)
  • Low total cost of ownership

8. Schema Discovery and Validation

8.1. Pre-Query Validation Rule

  • YOU MUST: Run DESCRIBE before executing SELECT on unfamiliar tables
  • YOU MUST: Verify exact column names and case before writing queries
-- Check table columns first
DESCRIBE TABLE catalog.schema.table_name;

-- Then write your query using verified column names
SELECT column_name FROM catalog.schema.table_name;

8.2. Schema Discovery Commands

-- Basic column info
DESCRIBE TABLE catalog.schema.table_name;

-- Extended info (types, nullability, comments)
DESCRIBE EXTENDED catalog.schema.table_name;

-- List tables in schema
SHOW TABLES IN catalog.schema;

-- Table properties and metadata
DESCRIBE DETAIL catalog.schema.table_name;

8.3. Common Gotchas

IssueCausePrevention
Column name caseDatabricks preserves caseUse DESCRIBE before query
Data type mismatchImplicit conversion failsCheck column types explicitly
NULL handlingUnexpected NULL in aggregationUse COALESCE or filter NULLs
Timestamp precisionTIMESTAMP vs TIMESTAMP_NTZVerify type before comparison

8.4. Knowledge Accumulation

When encountering schema-related issues, update this skill with:

  • Universal patterns (case sensitivity, type coercion rules)
  • Common column naming conventions in Unity Catalog
  • Databricks-specific SQL behaviors

NOTE: Do not include project-specific table names or business logic. Keep entries generalizable across environments.

9. VARIANT Type and JSON Operations

9.1. VARIANT Type (Runtime 15.3+)

Benefits:

  • 10-30x faster than JSON strings
  • Schema evolution without manual updates
  • No predefined schema required

Basic Usage:

-- Create table with VARIANT
CREATE TABLE events (
  id BIGINT,
  data VARIANT
);

-- Insert JSON data
INSERT INTO events VALUES
  (1, parse_json('{"name":"太郎","age":25}')),
  (2, parse_json('{"name":"花子","age":30,"new_field":"value"}'));

-- Query with colon notation
SELECT
  data:name::STRING AS name,
  data:age::INT AS age,
  data:new_field::STRING AS new_field  -- Auto-recognized
FROM events;

9.2. JSON Access Patterns

Colon Notation (Recommended):

-- Object fields
json_data:name
json_data:metadata.status

-- Array elements
json_data:tags[0]
json_data:tags[1]

-- Wildcards (all elements)
json_data:tags[*]  -- Returns array

-- Nested arrays
json_data:basket[*][0]  -- First element of each sub-array
json_data:basket[0][*]  -- All elements of first array

get_json_object() Function:

-- Basic usage
get_json_object(json_data, '$.name')
get_json_object(json_data, '$.tags[0]')
get_json_object(json_data, '$.metadata.status')

-- Limitation: Path must be STRING literal (no variables)

json_object_keys() Function:

-- Get all keys as array
SELECT json_object_keys(json_data) FROM table_name;
-- Result: ["name", "age", "tags", "metadata"]

-- Access by index (order not guaranteed)
SELECT
  json_object_keys(json_data)[0] AS first_key,
  get_json_object(json_data, '$.' || json_object_keys(json_data)[0]) AS first_value
FROM table_name;

Important Notes:

  • Object field order is NOT guaranteed in JSON
  • Array order IS guaranteed
  • Colon notation supports type casting: json_data:age::INT
  • Wildcards [*] only work with colon notation (not get_json_object)

10. Dashboard API (Lakeview)

10.1. Important Changes (2026)

  • Legacy Dashboard API: Deprecated (access disabled 2026-01-12)
  • Migration deadline: 2026-03-02
  • New API: Lakeview API (/api/2.0/lakeview/dashboards)

10.2. Dashboard Visualization Limitations

AI/BI Dashboard (Lakeview):

  • ❌ No custom HTML/JavaScript
  • ❌ No client-side JSON parsing
  • ✅ 20+ predefined visualization types
  • ✅ Query parameters for interactivity

Recommendation: Parse JSON in SQL (server-side) before visualization

11. dbt Integration Patterns

11.1. Auto-Schema Evolution with Jinja

Macro for Dynamic JSON Expansion:

-- macros/get_json_keys.sql
{% macro get_json_keys(table_ref, json_column) %}
  {% set query %}
    SELECT DISTINCT key
    FROM {{ table_ref }},
    LATERAL variant_explode({{ json_column }})
    ORDER BY key
  {% endset %}

  {% if execute %}
    {% set results = run_query(query) %}
    {% set keys = results.columns[0].values() %}
    {{ return(keys) }}
  {% else %}
    {{ return([]) }}
  {% endif %}
{% endmacro %}

dbt Model:

-- models/staging/stg_events.sql
{% set json_keys = get_json_keys(source('bronze', 'events'), 'json_data') %}

SELECT
  id,
  {% for key in json_keys %}
  json_data:{{ key }}::STRING AS {{ key | lower }}
  {%- if not loop.last %},{% endif %}
  {% endfor %}
FROM {{ source('bronze', 'events') }}

Benefits:

  • New JSON fields auto-detected on dbt run
  • No manual model updates required
  • Works with VARIANT or JSON string columns

11.2. Recommended Architecture

Source → Bronze (VARIANT) → Silver (dbt expand) → Gold (business logic)
  • Bronze: VARIANT型でRaw JSON保存
  • Silver: dbt Jinjaマクロで必要なフィールドを展開
  • Gold: ビジネスロジック、アグリゲーション

12. Reference Links

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.02%
按下载量换算106

Codex

26.72%
按下载量换算97

Antigravity

18.28%
按下载量换算67

windsurf

12.8%
按下载量换算47

trae

8.51%
按下载量换算31

OpenCode

3.44%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills