Unity Catalogメトリック表示: YAMLで統治されたビジネスメトリクス(事業の重要な数値指標)を定義・作成・検索・管理します。 次のような場合に使用: 標準化されたKPI(経営成績を測る主要指標)、売上メトリクス、注文分析、または複数のチーム・ツール間で一貫した定義が必要な再利用可能なビジネスメトリクスを構築する場合。
Unity Catalog metric views: define, create, query, and manage governed business metrics in YAML. Use when building standardized KPIs, revenue metrics, order analytics, or any reusable business metrics that need consistent definitions across teams and tools.
YAMLで再利用可能な統治下のビジネスメトリクスを定義し、測定値の定義と次元グループを分離することで、柔軟なクエリを実現します。
次のような場合に使用:
synonyms / display_name / format)の場合は 17.3以上CAN USE 権限を持つSQLウェアハウスSELECT 権限、ターゲットスキーマの CREATE TABLE + USE SCHEMA 権限| 作業内容 | リファレンス | 参照すべき場面 |
|---|---|---|
| 作成 | metric-view-advisor.md | 作成作業全般 — アドバイザーが完全なワークフロー(スキーマプロファイリング、ソース分析、提案、デプロイ)を処理します。create-patterns.md をYAML仕様とパターンリファレンスとして併読してください。 |
| YAML仕様 / パターン | create-patterns.md | パターン1~12、完全なYAMLフィールドリファレンス、フォーマットの注意点、デプロイエラー、クイックリファレンス。アドバイザーの補助資料です。パターン検索の場合は直接参照してください。 |
| クエリ | query-patterns.md | メトリックビューに対するSQLの作成 — MEASURE() の基本、フィルタ、結合のロールアップ、ウィンドウ測定値、ルール1~3。 |
| Genie統合 | metric-view-advisor.md §Genie Design Rules | ワンファクトソースルール、ベースビュー、ドメイン組織、命名規則。エージェントメタデータフィールド(comment、synonyms、display_name、format)は create-patterns.md §YAML Field Reference に記載されています。 |
典型的なフロー: アドバイザー → 作成 → クエリ/検証 → Genie統合(Genieエージェントに追加する場合)
メトリックビューをソースコード管理に置くには、その完全なSQL定義をコミットし、バンドル管理のSQLジョブを通じて実行します。DAB(宣言的自動化バンドル)にはネイティブなメトリックビューリソースがありませんが、バンドル管理のSQLジョブでコミットされた定義を適用できます:
# databricks.yml
bundle:
name: orders_metrics
variables:
catalog: { default: main }
schema: { default: default }
warehouse_id: { default: "" }
resources:
jobs:
deploy_orders_metrics:
name: deploy_orders_metrics
parameters:
- name: catalog
default: ${var.catalog}
- name: schema
default: ${var.schema}
tasks:
- task_key: create_metric_view
sql_task:
warehouse_id: ${var.warehouse_id}
file:
path: ../src/orders_metrics.metric_view.sql
デプロイと実行:
databricks bundle deploy --target <TARGET> --profile <PROFILE>
databricks bundle run deploy_orders_metrics --target <TARGET> --profile <PROFILE>
公式のメトリックビューバンドル例を参照してください。
Define reusable, governed business metrics in YAML that separate measure definitions from dimension groupings for flexible querying.
Use this skill when:
synonyms / display_name / format)CAN USE permissionsSELECT on source tables, CREATE TABLE + USE SCHEMA in the target schema| Task | Reference | Load when |
|---|---|---|
| Create | metric-view-advisor.md | Any creation task — the advisor handles the full workflow (profile schema, analyze sources, suggest, deploy). Load create-patterns.md alongside as the YAML spec and pattern reference. |
| YAML spec / patterns | create-patterns.md | Patterns 1–12, full YAML field reference, formatting gotchas, deployment errors, quick reference. Companion to the advisor; also load directly for pattern lookup. |
| Query | query-patterns.md | Writing SQL against a metric view — MEASURE() basics, filters, join rollups, window measures, Rules 1–3. |
| Genie integration | metric-view-advisor.md §Genie Design Rules | One-fact-source rule, base views, domain organization, naming. Agent metadata fields (comment, synonyms, display_name, format) are in create-patterns.md §YAML Field Reference. |
Typical flow: advisor → create → query/validate → Genie integration (if adding to a Genie Agent).
To source-control a metric view, commit its complete SQL definition and execute it through a bundle-managed SQL job. DABs do not have a native metric-view resource, but a bundle-managed SQL job can apply a committed definition:
# databricks.yml
bundle:
name: orders_metrics
variables:
catalog: { default: main }
schema: { default: default }
warehouse_id: { default: "" }
resources:
jobs:
deploy_orders_metrics:
name: deploy_orders_metrics
parameters:
- name: catalog
default: ${var.catalog}
- name: schema
default: ${var.schema}
tasks:
- task_key: create_metric_view
sql_task:
warehouse_id: ${var.warehouse_id}
file:
path: ../src/orders_metrics.metric_view.sql
Deploy and run:
databricks bundle deploy --target <TARGET> --profile <PROFILE>
databricks bundle run deploy_orders_metrics --target <TARGET> --profile <PROFILE>
See the official metric view bundle example.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。