claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdatabase

📊databricks-unity-catalog

プラグイン
databricks

説明

Unity Catalog のシステムテーブルおよびボリューム。 次のような場合に使用: - システムテーブル(監査、リネージ、課金)へのクエリ実行 - ボリュームのファイル操作(`/Volumes/` へのアップロード、ダウンロード、ファイル一覧の取得)

原文を表示

Unity Catalog system tables and volumes. Use when querying system tables (audit, lineage, billing) or working with volume file operations (upload, download, list files in /Volumes/).

ユースケース

  • システムテーブルにクエリを実行するとき
  • 監査情報を確認するとき
  • リネージを追跡するとき
  • 課金情報を取得するとき
  • ボリュームのファイル操作を行うとき

本文(日本語訳)

Unity Catalog

Unity Catalog のシステムテーブル、ボリューム、およびガバナンスに関するガイダンス。

このスキルの使いどころ

次のような場合に使用:

  • ボリュームの操作(/Volumes/ へのファイルのアップロード・ダウンロード・一覧取得)
  • リネージの照会(テーブルの依存関係、列レベルのリネージ)
  • 監査ログの分析(誰が何にアクセスしたか、権限の変更履歴)
  • 課金・使用状況の監視(DBU消費量、コスト分析)
  • コンピュートリソースの追跡(クラスター使用状況、ウェアハウスメトリクス)
  • ジョブ実行の確認(実行履歴、成功率、失敗内容)
  • クエリパフォーマンスの分析(遅いクエリ、ウェアハウスの利用状況)
  • データ品質のプロファイリング(データプロファイリング、ドリフト検出、メトリクステーブル)

参照ファイル

トピック ファイル 説明
システムテーブル references/5-system-tables.md リネージ、監査、課金、コンピュート、ジョブ、クエリ履歴
ボリューム references/6-volumes.md ボリュームのファイル操作、権限、ベストプラクティス
データプロファイリング references/7-data-profiling.md データプロファイリング、ドリフト検出、プロファイルメトリクス

クイックスタート

Unity Catalog オブジェクトの作成(CLI)

重要: UC オブジェクトの作成には --json を使用してください。 位置引数はコマンドおよびバージョンによって異なります。

# カタログの作成
databricks catalogs create my_catalog

# スキーマの作成(引数: NAME CATALOG_NAME — 位置引数、名前が先)
databricks schemas create my_schema my_catalog

# ボリュームの作成(引数: CATALOG_NAME SCHEMA_NAME NAME VOLUME_TYPE — カタログが先)
databricks volumes create my_catalog my_schema my_volume MANAGED

# カタログ・スキーマ・ボリュームの一覧取得
databricks catalogs list
databricks schemas list my_catalog
databricks volumes list my_catalog.my_schema

ボリュームのファイル操作(CLI)

databricks fs は UC Volume パスであっても dbfs: スキームプレフィックスが必要です。 省略するとCLIがパスをローカルファイルシステムとして解釈し、no such directory エラーが発生します。

# ボリューム内のファイル一覧を表示
databricks fs ls dbfs:/Volumes/catalog/schema/volume/path/

# ディレクトリの内容をボリュームにアップロード(-r はディレクトリ自体ではなく中身をコピー)
databricks fs cp -r --overwrite /tmp/data dbfs:/Volumes/catalog/schema/volume/dest

# ボリュームからファイルをダウンロード
databricks fs cp dbfs:/Volumes/catalog/schema/volume/file.csv /tmp/file.csv

# ボリューム内にディレクトリを作成
databricks fs mkdirs dbfs:/Volumes/catalog/schema/volume/new_folder

システムテーブルへのアクセス付与

-- システムテーブルへのアクセスを許可
GRANT USE CATALOG ON CATALOG system TO `data_engineers`;
GRANT USE SCHEMA ON SCHEMA system.access TO `data_engineers`;
GRANT SELECT ON SCHEMA system.access TO `data_engineers`;

よく使うクエリ

-- テーブルリネージ: このテーブルの元となるテーブルは何か?
SELECT source_table_full_name, source_column_name
FROM system.access.table_lineage
WHERE target_table_full_name = 'catalog.schema.table'
  AND event_date >= current_date() - 7;

-- 監査: 最近の権限変更
SELECT event_time, user_identity.email, action_name, request_params
FROM system.access.audit
WHERE action_name LIKE '%GRANT%' OR action_name LIKE '%REVOKE%'
ORDER BY event_time DESC
LIMIT 100;

-- 課金: ワークスペース別のDBU使用量
SELECT workspace_id, sku_name, SUM(usage_quantity) AS total_dbus
FROM system.billing.usage
WHERE usage_date >= current_date() - 30
GROUP BY workspace_id, sku_name;

CLI 経由でのSQLクエリ

システムテーブルへのクエリには databricks experimental aitools tools query を使用:

# CLI 経由でリネージを照会
databricks experimental aitools tools query --warehouse WAREHOUSE_ID "
  SELECT source_table_full_name, target_table_full_name
  FROM system.access.table_lineage
  WHERE event_date >= current_date() - 7
"

ベストプラクティス

  1. 日付でフィルタリングする — システムテーブルはデータ量が多いため、常に日付フィルターを使用すること
  2. 適切なリテンション設定を確認する — ワークスペースのデータ保持設定を確認すること
  3. 最小限のアクセス権を付与する — システムテーブルには機密性の高いメタデータが含まれる
  4. レポートをスケジュール実行する — 定期的な監視のためにスケジュールクエリを作成すること

関連スキル

  • databricks-pipelines — Unity Catalog テーブルに書き込むパイプラインの管理
  • databricks-jobs — システムテーブルで参照できるジョブ実行データの管理
  • databricks-synthetic-data-gen — Unity Catalog Volume に保存するデータの生成
  • databricks-aibi-dashboards — Unity Catalog データを基にしたダッシュボードの構築

参考資料

原文(English)を表示

Unity Catalog

Guidance for Unity Catalog system tables, volumes, and governance.

When to Use This Skill

Use this skill when:

  • Working with volumes (upload, download, list files in /Volumes/)
  • Querying lineage (table dependencies, column-level lineage)
  • Analyzing audit logs (who accessed what, permission changes)
  • Monitoring billing and usage (DBU consumption, cost analysis)
  • Tracking compute resources (cluster usage, warehouse metrics)
  • Reviewing job execution (run history, success rates, failures)
  • Analyzing query performance (slow queries, warehouse utilization)
  • Profiling data quality (data profiling, drift detection, metric tables)

Reference Files

Topic File Description
System Tables references/5-system-tables.md Lineage, audit, billing, compute, jobs, query history
Volumes references/6-volumes.md Volume file operations, permissions, best practices
Data Profiling references/7-data-profiling.md Data profiling, drift detection, profile metrics

Quick Start

Create Unity Catalog Objects (CLI)

IMPORTANT: Use --json for creating UC objects. Positional args vary by command and version.

# Create a catalog
databricks catalogs create my_catalog

# Create a schema  (args: NAME CATALOG_NAME — positional, name first)
databricks schemas create my_schema my_catalog

# Create a volume  (args: CATALOG_NAME SCHEMA_NAME NAME VOLUME_TYPE — catalog first)
databricks volumes create my_catalog my_schema my_volume MANAGED

# List catalogs, schemas, volumes
databricks catalogs list
databricks schemas list my_catalog
databricks volumes list my_catalog.my_schema

Volume File Operations (CLI)

databricks fs requires the dbfs: scheme prefix even for UC Volume paths — without it the CLI treats the path as local filesystem and errors with no such directory.

# List files in a volume
databricks fs ls dbfs:/Volumes/catalog/schema/volume/path/

# Upload a directory's contents to a volume (-r copies contents, not the directory itself)
databricks fs cp -r --overwrite /tmp/data dbfs:/Volumes/catalog/schema/volume/dest

# Download a file from a volume
databricks fs cp dbfs:/Volumes/catalog/schema/volume/file.csv /tmp/file.csv

# Create a directory in a volume
databricks fs mkdirs dbfs:/Volumes/catalog/schema/volume/new_folder

Enable System Tables Access

-- Grant access to system tables
GRANT USE CATALOG ON CATALOG system TO `data_engineers`;
GRANT USE SCHEMA ON SCHEMA system.access TO `data_engineers`;
GRANT SELECT ON SCHEMA system.access TO `data_engineers`;

Common Queries

-- Table lineage: What tables feed into this table?
SELECT source_table_full_name, source_column_name
FROM system.access.table_lineage
WHERE target_table_full_name = 'catalog.schema.table'
  AND event_date >= current_date() - 7;

-- Audit: Recent permission changes
SELECT event_time, user_identity.email, action_name, request_params
FROM system.access.audit
WHERE action_name LIKE '%GRANT%' OR action_name LIKE '%REVOKE%'
ORDER BY event_time DESC
LIMIT 100;

-- Billing: DBU usage by workspace
SELECT workspace_id, sku_name, SUM(usage_quantity) AS total_dbus
FROM system.billing.usage
WHERE usage_date >= current_date() - 30
GROUP BY workspace_id, sku_name;

SQL Queries via CLI

Use databricks experimental aitools tools query for system table queries:

# Query lineage via CLI
databricks experimental aitools tools query --warehouse WAREHOUSE_ID "
  SELECT source_table_full_name, target_table_full_name
  FROM system.access.table_lineage
  WHERE event_date >= current_date() - 7
"

Best Practices

  1. Filter by date - System tables can be large; always use date filters
  2. Use appropriate retention - Check your workspace's retention settings
  3. Grant minimal access - System tables contain sensitive metadata
  4. Schedule reports - Create scheduled queries for regular monitoring

Related Skills

  • databricks-pipelines - for pipelines that write to Unity Catalog tables
  • databricks-jobs - for job execution data visible in system tables
  • databricks-synthetic-data-gen - for generating data stored in Unity Catalog Volumes
  • databricks-aibi-dashboards - for building dashboards on top of Unity Catalog data

Resources

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。