claude-skills/

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

last sync 22h ago
スキルOfficialdevelopment

📊aidp-profiling-tables

説明

AIDPテーブルのプロファイリングを実行します。取得できる情報は以下の通りです: - 行数 - カラムごとのnull率(%) - ユニーク値の数 - 最小値 / 最大値 / 平均値 - 上位K件の値 次のような場合に使用: ユーザーがテーブルのプロファイリングを要求した場合、カラムの統計情報やデータ品質のスナップショットを必要としている場合、またはデータセットを利用する前にその構造を把握したい場合。 付属の `aidp_sql.py` ヘルパーを通じて、範囲を限定したSpark SQLで実行されます。

原文を表示

Profile an AIDP table — row count, per-column null %, distinct count, min/max/mean, and top-K values. Use when the user asks to profile a table, wants column statistics or a data-quality snapshot, or needs to understand a dataset's shape before using it. Runs bounded Spark SQL via the bundled aidp_sql.py helper.

ユースケース

  • テーブルのプロファイリングを要求されたとき
  • カラムの統計情報が必要なとき
  • データ品質を確認するとき
  • データセットの構造を把握したいとき

本文(日本語訳)

aidp-profiling-tables — 単一テーブルプロファイル

Spark SQL を使用して AIDP テーブルの列レベルのプロファイルを生成します。 完全自己完結型: コントロールプレーンへのルックアップは oci raw-request を使用し、 プロファイリング SQL はバンドル済みの scripts/aidp_sql.py ヘルパー経由で実行します。 AIDP MCP サーバーは不要です。

次のような場合に使用

  • <table> をプロファイルして」「<table> の中身を教えて」「列の統計情報 / データ品質のスナップショットが欲しい」

ワークフロー

1. テーブルの解決

aidp-catalog-explore または .aidp/catalog.md を使用してテーブルを特定し、 catalog.schema.table の完全修飾名と列名・型を取得します。 キャッシュがない場合は oci raw-request で一覧を取得してください:

GET /tables?catalogKey=<cat>&schemaKey=<cat.schema>

クライアント側でテーブルをフィルタリングします (references/no-mcp-rest-map.md 参照)。 列の型をもとに、各列に適したプロファイリング SQL を選択してください。


2. ヘルパー経由でプロファイリング SQL を実行(コール 1 回につき 1 セル; スクラッチノートブックとカーネルは自動管理)

python "$PLUGIN_DIR/scripts/aidp_sql.py" --region <r> --datalake <ocid> --workspace <ws> --cluster <key> \
  --code "spark.sql('''<profiling SQL>''').show(50, truncate=False)"

実行する SQL の内容:

  • 概要: SELECT COUNT(*) FROM t(大規模テーブルの場合はフラグを立て、以降はサンプルを使用)
  • 数値列: MINMAXAVGCOUNT、null 率、近似ユニーク数(approx_count_distinct
  • 文字列 / カテゴリ列: null 率、approx_count_distinctGROUP BY … ORDER BY count DESC LIMIT k による上位 K 件
  • 日付 / タイムスタンプ列: MIN/MAX の範囲、null 率

大規模テーブルではコストを抑えるため TABLESAMPLE / LIMIT を使用し、 サンプリングを行った場合はその旨を明示してください。 ヘルパーは JSON(statusoutputsspark_job_ids)を返します — outputs を解析して結果行を取得してください。


3. 結果の提示

列ごとのテーブルとして以下を提示します: 型 / null 率 / ユニーク数 / 最小・最大・平均(数値列)/ 上位値(カテゴリ列)


4. 次のアクションの提案

  • 得られた知見を .aidp/catalog.md の値辞書へ反映する(aidp-catalog-init
  • データ品質ルールを追加する(aidp-data-quality

信頼性ルール

  • プロファイルは実際のクエリ結果に基づいて生成し、推測で補完しないこと。サンプリングした場合はその旨を明記すること。
  • 非常に大規模なテーブルの場合はサンプルをプロファイルし、その旨を明確にラベル付けすること。
  • ヘルパーは api_key の DEFAULT プロファイルから UPST を生成し、スクラッチノートブックを自動作成します。 テナンシーがセッショントークン専用の場合のみ --session-profile AIDP_SESSION を渡してください。 カーネル / 認証エラーが発生した場合は、oci session refresh --profile AIDP_SESSION でリフレッシュしてからリトライしてください。

参考情報

原文(English)を表示

aidp-profiling-tables — single-table profile

Produce a column-level profile of an AIDP table via Spark SQL. Self-contained: control-plane lookups use oci raw-request; profiling SQL runs through the bundled scripts/aidp_sql.py helper. No aidp MCP server is required.

When to use

  • "Profile <table>", "what does <table> look like", "column stats / data quality snapshot".

Workflow

  1. Resolve the table (aidp-catalog-explore / .aidp/catalog.md) → fully-qualified catalog.schema.table and its columns/types. Without a cache, list via oci raw-request: GET /tables?catalogKey=<cat>&schemaKey=<cat.schema> and filter for the table client-side (see references/no-mcp-rest-map.md). Use the column types to pick the right per-column profiling SQL.
  2. Run bounded profiling SQL via the helper (one cell per call; the scratch notebook + kernel are managed for you):
    python "$PLUGIN_DIR/scripts/aidp_sql.py" --region <r> --datalake <ocid> --workspace <ws> --cluster <key> \
      --code "spark.sql('''<profiling SQL>''').show(50, truncate=False)"
    
    • Overview: SELECT COUNT(*) FROM t (flag if LARGE; sample for the rest).
    • Numeric cols: MIN, MAX, AVG, COUNT, null %, approx distinct (approx_count_distinct).
    • String/categorical: null %, approx_count_distinct, top-K via GROUP BY … ORDER BY count DESC LIMIT k.
    • Date/timestamp: MIN/MAX range, null %. Use TABLESAMPLE/LIMIT on large tables to stay cheap; say when you sampled. The helper returns JSON (status, outputs, spark_job_ids) — parse outputs for the result rows.
  3. Present a per-column table: type, null %, distinct, min/max/mean (numeric), top values (categorical).
  4. Offer to feed findings into .aidp/catalog.md value dictionaries (aidp-catalog-init) and to add data-quality rules (aidp-data-quality).

Reliability rules

  • Profile from real query output, not assumptions; note sampling.
  • For very large tables, profile a sample and label it clearly.
  • The helper mints a UPST from the api_key DEFAULT profile and auto-creates a scratch notebook; pass --session-profile AIDP_SESSION only if your tenancy is session-token-only. On a kernel/auth error, refresh (oci session refresh --profile AIDP_SESSION) and retry.

References

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