{"id":8528,"date":"2026-05-25T15:00:01","date_gmt":"2026-05-25T06:00:01","guid":{"rendered":"https:\/\/since2020.jp\/media\/?p=8528"},"modified":"2026-05-25T15:00:01","modified_gmt":"2026-05-25T06:00:01","slug":"databricks-metric-view-yaml","status":"publish","type":"post","link":"https:\/\/since2020.jp\/media\/databricks-metric-view-yaml\/","title":{"rendered":"Databricks Metric View\u306eYAML\u8a2d\u5b9a\u9805\u76ee\u3092\u5fb9\u5e95\u89e3\u8aac"},"content":{"rendered":"\n<p>Databricks \u306e Metric View \u306f\u3001Unity Catalog \u4e0a\u3067 KPI \u3084\u696d\u7e3e\u6307\u6a19\u3092\u300c\u4e00\u304b\u6240\u3067\u5b9a\u7fa9\u30fb\u518d\u5229\u7528\u300d\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/p>\n\n\n\n<p>BI \u30c4\u30fc\u30eb\u3084 Genie \u306a\u3069\u8907\u6570\u306e\u5834\u6240\u304b\u3089\u540c\u3058\u6307\u6a19\u3092\u53c2\u7167\u3067\u304d\u308b\u305f\u3081\u3001\u300c\u30c1\u30fc\u30e0\u306b\u3088\u3063\u3066\u6570\u5b57\u304c\u9055\u3046\u2026\u300d\u3068\u3044\u3046\u53e4\u5178\u7684\u306a\u554f\u984c\u3092\u6839\u672c\u304b\u3089\u89e3\u6c7a\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Metric View \u3092 YAML \u3067\u5b9a\u7fa9\u3059\u308b\u969b\u306b\u4f7f\u3048\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u3072\u3068\u901a\u308a\u6574\u7406\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u306e\u304c\u5927\u5909\u3068\u3044\u3046\u65b9\u3084\u3001\u300c\u3042\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3069\u3053\u306b\u66f8\u304f\u3093\u3060\u3063\u3051\uff1f\u300d\u3068\u306a\u3063\u305f\u3068\u304d\u306e\u8f9e\u66f8\u4ee3\u308f\u308a\u306b\u6d3b\u7528\u3057\u3066\u3082\u3089\u3048\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Databricks Metric View\u306eYAML\u5b9a\u7fa9\u3068\u306f<\/h2>\n\n\n\n<p>Metric View \u306e YAML \u306f\u4ee5\u4e0b\u306e\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u30ad\u30fc\u3067\u69cb\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>version<\/code><\/td><td>\u5fc5\u9808<\/td><td>YAML \u4ed5\u69d8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\uff08<code>0.1<\/code> or <code>1.1<\/code>\uff09<\/td><\/tr><tr><td><code>source<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u5143\uff08\u30c6\u30fc\u30d6\u30eb\u540d or SQL \u30af\u30a8\u30ea\uff09<\/td><\/tr><tr><td><code>dimensions<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u96c6\u8a08\u306e\u8ef8\u306b\u306a\u308b\u5217\u306e\u5b9a\u7fa9\u3002<code>measures<\/code> \u304c\u306a\u3051\u308c\u3070\u5fc5\u9808<\/td><\/tr><tr><td><code>measures<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u96c6\u8a08\u5024\uff08KPI\uff09\u306e\u5b9a\u7fa9\u3002<code>dimensions<\/code> \u304c\u306a\u3051\u308c\u3070\u5fc5\u9808<\/td><\/tr><tr><td><code>comment<\/code><\/td><td>\u4efb\u610f<\/td><td>\u3053\u306e Metric View \u5168\u4f53\u306e\u8aac\u660e\u30e1\u30e2<\/td><\/tr><tr><td><code>filter<\/code><\/td><td>\u4efb\u610f<\/td><td>\u5168\u30af\u30a8\u30ea\u306b\u81ea\u52d5\u3067\u9069\u7528\u3055\u308c\u308b\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6<\/td><\/tr><tr><td><code>joins<\/code><\/td><td>\u4efb\u610f<\/td><td>\u4ed6\u30c6\u30fc\u30d6\u30eb\u3068\u306e\u7d50\u5408\u5b9a\u7fa9\uff08\u30b9\u30bf\u30fc\u30fb\u30b9\u30ce\u30fc\u30d5\u30ec\u30fc\u30af\u5bfe\u5fdc\uff09<\/td><\/tr><tr><td><code>materialization<\/code><\/td><td>\u4efb\u610f<\/td><td>\u30af\u30a8\u30ea\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u30de\u30c6\u30ea\u30a2\u30e9\u30a4\u30ba\u30c9\u30d3\u30e5\u30fc\u8a2d\u5b9a<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><code>dimensions<\/code> \u3068 <code>measures<\/code> \u306f\u3069\u3061\u3089\u304b\u4e00\u65b9\u304c\u3042\u308c\u3070 OK \u3067\u3059\u304c\u3001\u5b9f\u904b\u7528\u3067\u306f\u307b\u307c\u4e21\u65b9\u66f8\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u964d\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u3001\u5404\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u4f7f\u3044\u65b9\u3092\u9806\u756a\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>source<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u5143\u3092\u6307\u5b9a\u3059\u308b<\/h2>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u30fb\u30d3\u30e5\u30fc\u30fb\u30de\u30c6\u30ea\u30a2\u30e9\u30a4\u30ba\u30c9\u30d3\u30e5\u30fc\u30fb\u30b9\u30c8\u30ea\u30fc\u30df\u30f3\u30b0\u30c6\u30fc\u30d6\u30eb\u30fb\u5916\u90e8\u30c6\u30fc\u30d6\u30eb\u30fb\u30b7\u30b9\u30c6\u30e0\u30c6\u30fc\u30d6\u30eb\u30fb\u5225\u306e Metric View \u306a\u3069\u3001Unity Catalog \u4e0a\u3067 <code>SELECT<\/code> \u304c\u4f7f\u3048\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3089\u307b\u307c\u4f55\u3067\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f <code>catalog.schema.table<\/code> \u306e\u5f62\u5f0f\u3067\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5225\u306e Metric View \u3092 <code>source<\/code> \u306b\u3059\u308b\u3053\u3068\u3067\u3001\u6307\u6a19\u306e\u300c\u7d44\u307f\u5408\u308f\u305b\u300d\u3082\u4f5c\u308c\u307e\u3059\uff08\u30b3\u30f3\u30dd\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u30d1\u30bf\u30fc\u30f3\u2460\uff1a\u30c6\u30fc\u30d6\u30eb\u3092\u305d\u306e\u307e\u307e\u6307\u5b9a\nsource: my_catalog.sales.transactions\n\n# \u30d1\u30bf\u30fc\u30f3\u2461\uff1aSQL \u30af\u30a8\u30ea\u3092\u76f4\u63a5\u8a18\u8ff0\uff08JOIN \u3082\u53ef\u80fd\uff09\nsource: |\n  SELECT *\n  FROM my_catalog.sales.transactions t\n  LEFT JOIN my_catalog.master.customers c\n    ON t.customer_id = c.id\n\n# \u30d1\u30bf\u30fc\u30f3\u2462\uff1a\u5225\u306e Metric View \u3092\u6307\u5b9a\uff08\u30b3\u30f3\u30dd\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\uff09\nsource: my_catalog.my_schema.base_metric_view\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>dimensions<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u96c6\u8a08\u306e\u300c\u8ef8\u300d\u3092\u5b9a\u7fa9\u3059\u308b<\/h2>\n\n\n\n<p>\u30c7\u30a3\u30e1\u30f3\u30b7\u30e7\u30f3\u306f <code>GROUP BY<\/code> \u3084 <code>WHERE<\/code> \u3067\u4f7f\u3046\u5217\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5358\u7d14\u306a\u5217\u53c2\u7167\u3060\u3051\u3067\u306a\u304f\u3001<code>CASE WHEN<\/code> \u3084 <code>DATE_TRUNC<\/code> \u306a\u3069\u306e SQL \u5f0f\u3082\u66f8\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>\u5fc5\u9808<\/td><td>YAML \u5185\u90e8\u3067\u306e\u8b58\u5225\u5b50\u3002<code>materialization<\/code> \u304b\u3089\u3082\u3053\u3053\u3067\u4ed8\u3051\u305f\u540d\u524d\u3067\u53c2\u7167\u3059\u308b<\/td><\/tr><tr><td><code>expr<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u5b9f\u969b\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b SQL \u5f0f<\/td><\/tr><tr><td><code>comment<\/code><\/td><td>\u4efb\u610f<\/td><td>Unity Catalog \u306b\u4fdd\u5b58\u3055\u308c\u308b\u30e1\u30e2\u3002\u7ba1\u7406\u8005\u5411\u3051\u306e\u8aac\u660e\u306b\u4f7f\u3046<\/td><\/tr><tr><td><code>display_name<\/code><\/td><td>\u4efb\u610f<\/td><td>Genie \u3084 BI \u30c4\u30fc\u30eb\u4e0a\u306b\u8868\u793a\u3055\u308c\u308b\u540d\u524d\uff08\u65e5\u672c\u8a9e\u30fb\u30b9\u30da\u30fc\u30b9\u53ef\uff09\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><tr><td><code>format<\/code><\/td><td>\u4efb\u610f<\/td><td>\u5024\u306e\u8868\u793a\u5f62\u5f0f\uff08\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3001\u901a\u8ca8\u306a\u3069\uff09\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><tr><td><code>synonyms<\/code><\/td><td>\u4efb\u610f<\/td><td>Genie \u304c\u81ea\u7136\u8a00\u8a9e\u3067\u8cea\u554f\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306e\u5225\u540d\u30ea\u30b9\u30c8\uff08\u6700\u5927 10 \u500b\uff09\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>dimensions:\n  - name: purchased_at\n    expr: purchased_at\n    comment: '\u8cfc\u5165\u65e5\u6642\uff08\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u578b\uff09'\n    display_name: '\u8cfc\u5165\u65e5'\n    synonyms: &#091;'\u8cb7\u3063\u305f\u65e5', '\u6ce8\u6587\u65e5']\n\n  - name: payment_method\n    expr: |\n      CASE\n        WHEN payment_type = 'CREDIT' THEN '\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9'\n        WHEN payment_type = 'CASH'   THEN '\u73fe\u91d1'\n        ELSE '\u305d\u306e\u4ed6'\n      END\n    display_name: '\u652f\u6255\u3044\u65b9\u6cd5'\n    synonyms: &#091;'\u6c7a\u6e08\u65b9\u6cd5', '\u652f\u6255\u65b9\u6cd5']\n<\/code><\/pre>\n\n\n\n<p><code>name<\/code> \u306f\u5185\u90e8\u8b58\u5225\u5b50\u306a\u306e\u3067\u82f1\u6570\u5b57\u30fb\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u63a8\u5968\u3067\u3059\u3002<\/p>\n\n\n\n<p><code>display_name<\/code> \u306f\u4eba\u304c\u76ee\u306b\u3059\u308b\u8868\u793a\u540d\u306a\u306e\u3067\u65e5\u672c\u8a9e\u3084\u7a7a\u767d\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>synonyms<\/code> \u306b\u767b\u9332\u3057\u3066\u304a\u304f\u3068\u3001\u300c\u6c7a\u6e08\u65b9\u6cd5\u3092\u6559\u3048\u3066\u300d\u300c\u652f\u6255\u65b9\u6cd5\u306f\uff1f\u300d\u3068\u3044\u3063\u305f\u8cea\u554f\u3067\u3082 Genie \u304c\u6b63\u3057\u304f\u53c2\u7167\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>measures<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u696d\u7e3e\u6307\u6a19\uff08KPI\uff09\u3092\u5b9a\u7fa9\u3059\u308b<\/h2>\n\n\n\n<p>\u30e1\u30b8\u30e3\u30fc\u306f <code>SUM<\/code>\u30fb<code>COUNT<\/code>\u30fb<code>AVG<\/code> \u306a\u3069\u306e\u96c6\u8a08\u95a2\u6570\u3092\u5fc5\u305a\u542b\u3080\u5f0f\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30af\u30a8\u30ea\u304b\u3089\u4f7f\u3046\u3068\u304d\u306f <code>MEASURE()<\/code> \u95a2\u6570\u3067\u30e9\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u5185\u90e8\u8b58\u5225\u5b50<\/td><\/tr><tr><td><code>expr<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u96c6\u8a08\u95a2\u6570\u3092\u542b\u3080 SQL \u5f0f\u3002<code>SUM<\/code> \u3084 <code>COUNT<\/code> \u306a\u3069\u306e\u96c6\u8a08\u95a2\u6570\u3092\u5fc5\u305a\u4f7f\u3046\u3053\u3068<\/td><\/tr><tr><td><code>comment<\/code><\/td><td>\u4efb\u610f<\/td><td>Unity Catalog \u306b\u4fdd\u5b58\u3055\u308c\u308b\u30e1\u30e2<\/td><\/tr><tr><td><code>display_name<\/code><\/td><td>\u4efb\u610f<\/td><td>\u8868\u793a\u540d\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><tr><td><code>format<\/code><\/td><td>\u4efb\u610f<\/td><td>\u5024\u306e\u8868\u793a\u5f62\u5f0f\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><tr><td><code>synonyms<\/code><\/td><td>\u4efb\u610f<\/td><td>\u300c\u58f2\u4e0a\u9ad8\u306f\uff1f\u300d\u300c\u7dcf\u58f2\u4e0a\u3092\u6559\u3048\u3066\u300d\u3068\u3044\u3063\u305f\u8cea\u554f\u3067\u3082 Genie \u304c\u6b63\u3057\u304f\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u5225\u540d\u30ea\u30b9\u30c8\uff08\u6700\u5927 10 \u500b\uff09\u3002\u4ed5\u69d8 v1.1 \u304c\u5fc5\u8981<\/td><\/tr><tr><td><code>window<\/code><\/td><td>\u4efb\u610f<\/td><td>\u79fb\u52d5\u96c6\u8a08\u30fb\u7d2f\u7a4d\u96c6\u8a08\u3092\u5b9a\u7fa9\u3059\u308b\uff08Experimental\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>measures:\n  - name: total_sales\n    expr: SUM(amount)\n    comment: '\u7a0e\u8fbc\u307f\u306e\u58f2\u4e0a\u5408\u8a08\u91d1\u984d'\n    display_name: '\u58f2\u4e0a\u5408\u8a08'\n    synonyms: &#091;'\u58f2\u4e0a\u9ad8', '\u7dcf\u58f2\u4e0a', '\u58f2\u308a\u4e0a\u3052']\n    format:\n      type: currency\n      currency_code: JPY\n\n  - name: online_sales\n    expr: SUM(amount) FILTER (WHERE channel = 'ONLINE')\n    display_name: '\u30aa\u30f3\u30e9\u30a4\u30f3\u58f2\u4e0a'\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><code>display_name<\/code> \u3068 <code>format<\/code> \u306e\u4f7f\u3044\u5206\u3051<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>display_name<\/code> \u2192 \u5217\u306e\u300c\u540d\u524d\u300d\u3092\u3069\u3046\u8868\u793a\u3059\u308b\u304b<\/li>\n\n\n\n<li><code>format<\/code> \u2192 \u5024\u306e\u300c\u898b\u305f\u76ee\u300d\u3092\u3069\u3046\u6574\u3048\u308b\u304b<\/li>\n<\/ul>\n\n\n\n<p>\u4e0a\u306e\u4f8b\u3067\u3044\u3046\u3068\u3001\u753b\u9762\u4e0a\u306b\u306f <code>\u58f2\u4e0a\u5408\u8a08\uff08display_name\uff09<\/code> \u3068\u3044\u3046\u5217\u898b\u51fa\u3057\u306e\u4e0b\u306b <code>\u00a51,234,567\uff08format\uff09<\/code> \u3068\u3044\u3046\u5024\u304c\u8868\u793a\u3055\u308c\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>window<\/code>\u3067\u79fb\u52d5\u96c6\u8a08\u30fb\u7d2f\u7a4d\u96c6\u8a08\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>measures:\n  - name: rolling_7day_sales\n    expr: SUM(amount)\n    display_name: '\u76f4\u8fd17\u65e5\u9593\u306e\u58f2\u4e0a\u5408\u8a08'\n    window:\n      - order: purchased_at      # \u3069\u306e\u30c7\u30a3\u30e1\u30f3\u30b7\u30e7\u30f3\u3092\u57fa\u6e96\u306b\u4e26\u3079\u308b\u304b\n        range: trailing 7 day    # \u96c6\u8a08\u7bc4\u56f2\n        semiadditive: last\n<\/code><\/pre>\n\n\n\n<p><code>range<\/code> \u306b\u6307\u5b9a\u3067\u304d\u308b\u5024\u306f <code>current<\/code>\u30fb<code>cumulative<\/code>\u30fb<code>trailing N unit<\/code>\u30fb<code>leading N unit<\/code>\u30fb<code>all<\/code> \u306e 5 \u7a2e\u985e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u9031\u6b21\u30ed\u30fc\u30ea\u30f3\u30b0\u96c6\u8a08\u3084\u7d2f\u8a08\u5024\u304c\u5fc5\u8981\u306a\u5834\u9762\u3067\u6d3b\u8e8d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u306a\u304a\u3001\u3053\u306e\u6a5f\u80fd\u306f\u73fe\u5728 Experimental \u30b9\u30c6\u30fc\u30bf\u30b9\u306e\u305f\u3081\u3001\u672c\u756a\u5229\u7528\u306e\u969b\u306f\u52d5\u4f5c\u78ba\u8a8d\u3092\u5341\u5206\u306b\u884c\u3046\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>comment<\/code>\u306e\u66f8\u304d\u65b9\uff1aMetric View \u306e\u8aac\u660e\u3092\u6b8b\u3059<\/h2>\n\n\n\n<p>\u4efb\u610f\u9805\u76ee\u3067\u3059\u304c\u3001Unity Catalog \u4e0a\u306b\u8868\u793a\u3055\u308c\u308b\u30e1\u30e2\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5f8c\u304b\u3089\u898b\u305f\u3068\u304d\u306b\u300c\u3053\u306e\u30d3\u30e5\u30fc\u306f\u4f55\u306e\u305f\u3081\u306b\u3042\u308b\u306e\u304b\u300d\u304c\u3059\u3050\u308f\u304b\u308b\u3088\u3046\u3001\u4e00\u8a00\u3067\u3082\u66f8\u3044\u3066\u304a\u304f\u3068\u904b\u7528\u304c\u697d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>comment: '\u5e97\u8217\u5225\u30fb\u30c1\u30e3\u30cd\u30eb\u5225\u306e\u58f2\u4e0a\u96c6\u8a08\u30d3\u30e5\u30fc\u3002\u6708\u6b21\u30ec\u30dd\u30fc\u30c8\u304a\u3088\u3073 Genie \u304b\u3089\u306e\u53c2\u7167\u3092\u60f3\u5b9a\u3002'\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>filter<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u5168\u30af\u30a8\u30ea\u306b\u5171\u901a\u306e\u7d5e\u308a\u8fbc\u307f\u3092\u304b\u3051\u308b<\/h2>\n\n\n\n<p><code>filter<\/code> \u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u3053\u306e Metric View \u3092\u53c2\u7167\u3059\u308b\u3059\u3079\u3066\u306e\u30af\u30a8\u30ea\u306b\u81ea\u52d5\u3067 WHERE \u6761\u4ef6\u304c\u4ed8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u300c\u3053\u306e\u30d3\u30e5\u30fc\u306f\u76f4\u8fd11\u5e74\u5206\u3060\u3051\u4f7f\u3046\u300d\u300c\u30c6\u30b9\u30c8\u6ce8\u6587\u306f\u9664\u5916\u3057\u305f\u3044\u300d\u3068\u3044\u3063\u305f\u5171\u901a\u30eb\u30fc\u30eb\u3092\u4e00\u304b\u6240\u306b\u96c6\u7d04\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5358\u4e00\u6761\u4ef6\nfilter: purchased_at &gt; '2024-01-01'\n\n# AND \u3067\u8907\u6570\u6761\u4ef6\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\nfilter: purchased_at &gt; '2024-01-01' AND channel = 'ONLINE'\n<\/code><\/pre>\n\n\n\n<p>SQL \u306e WHERE \u53e5\u3068\u540c\u3058\u8a18\u6cd5\u304c\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30af\u30a8\u30ea\u5b9f\u884c\u6642\u306b\u8ffd\u52a0\u3067\u7d5e\u308a\u8fbc\u3080\u3053\u3068\u306f\u5f15\u304d\u7d9a\u304d\u53ef\u80fd\u306a\u306e\u3067\u3001\u300cMetric View \u5074\u3067\u5927\u67a0\u3092\u56fa\u5b9a\u3057\u3001\u30af\u30a8\u30ea\u5074\u3067\u7d30\u304b\u304f\u7d5e\u308b\u300d\u3068\u3044\u3046\u4f7f\u3044\u65b9\u304c\u81ea\u7136\u3067\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>joins<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u8907\u6570\u30c6\u30fc\u30d6\u30eb\u3092\u7d44\u307f\u5408\u308f\u305b\u308b<\/h2>\n\n\n\n<p>\u5358\u4e00\u30c6\u30fc\u30d6\u30eb\u3060\u3051\u3067\u306a\u304f\u3001\u30b9\u30bf\u30fc\u30b9\u30ad\u30fc\u30de\u3084\u30b9\u30ce\u30fc\u30d5\u30ec\u30fc\u30af\u30b9\u30ad\u30fc\u30de\u69cb\u6210\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u7d50\u5408\u30c6\u30fc\u30d6\u30eb\u306e\u5225\u540d<\/td><\/tr><tr><td><code>source<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u7d50\u5408\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092 <code>catalog.schema.table<\/code> \u306e\u5f62\u5f0f\u3067\u6307\u5b9a\u3059\u308b<\/td><\/tr><tr><td><code>on<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u7d50\u5408\u6761\u4ef6\u3092 SQL \u306e\u6761\u4ef6\u5f0f\u3067\u8a18\u8ff0\u3002<code>using<\/code> \u304c\u306a\u3051\u308c\u3070\u5fc5\u9808<\/td><\/tr><tr><td><code>using<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u4e21\u30c6\u30fc\u30d6\u30eb\u306b\u540c\u540d\u306e\u5217\u304c\u3042\u308b\u5834\u5408\u306b\u4f7f\u3048\u308b\u7701\u7565\u8a18\u6cd5\u3002<code>on<\/code> \u304c\u306a\u3051\u308c\u3070\u5fc5\u9808<\/td><\/tr><tr><td><code>joins<\/code><\/td><td>\u4efb\u610f<\/td><td>\u30cd\u30b9\u30c8\u3057\u305f\u7d50\u5408\uff08\u30b9\u30ce\u30fc\u30d5\u30ec\u30fc\u30af\u69cb\u9020\u306b\u4f7f\u3046\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>version: 1.1\nsource: my_catalog.sales.transactions   # \u30d5\u30a1\u30af\u30c8\u30c6\u30fc\u30d6\u30eb\uff08\u58f2\u4e0a\u660e\u7d30\uff09\n\njoins:\n  - name: stores\n    source: my_catalog.master.stores\n    on: source.store_id = stores.id\n  - name: products\n    source: my_catalog.master.products\n    on: source.product_id = products.id\n\ndimensions:\n  - name: store_region\n    expr: stores.region        # \u5225\u540d.\u5217\u540d \u3067\u53c2\u7167\n  - name: product_category\n    expr: products.category\n<\/code><\/pre>\n\n\n\n<p><code>on<\/code> \u53e5\u3067\u306f <code>source.\u5217\u540d<\/code> \u3067\u30d5\u30a1\u30af\u30c8\u30c6\u30fc\u30d6\u30eb\u5074\u3092\u3001<code>\u5225\u540d.\u5217\u540d<\/code> \u3067\u7d50\u5408\u30c6\u30fc\u30d6\u30eb\u5074\u3092\u533a\u5225\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b9\u30ce\u30fc\u30d5\u30ec\u30fc\u30af\u69cb\u9020\u306b\u3057\u305f\u3044\u5834\u5408\u306f <code>joins<\/code> \u306e\u4e2d\u306b\u3055\u3089\u306b <code>joins<\/code> \u3092\u30cd\u30b9\u30c8\u3057\u3066\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><code>materialization<\/code>\u306e\u66f8\u304d\u65b9\uff1a\u30af\u30a8\u30ea\u3092\u4e8b\u524d\u8a08\u7b97\u3067\u9ad8\u901f\u5316\u3059\u308b<\/h2>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f Metric View \u306f\u666e\u901a\u306e\u30d3\u30e5\u30fc\u3068\u540c\u3058\u304f\u3001\u53c2\u7167\u306e\u305f\u3073\u306b\u30af\u30a8\u30ea\u304c\u8d70\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>materialization<\/code> \u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u3088\u304f\u4f7f\u3046\u96c6\u8a08\u3092\u30de\u30c6\u30ea\u30a2\u30e9\u30a4\u30ba\u30c9\u30d3\u30e5\u30fc\u3068\u3057\u3066\u4e8b\u524d\u8a08\u7b97\u30fb\u4fdd\u5b58\u3057\u3066\u304a\u304d\u3001\u30af\u30a8\u30ea\u3092\u9ad8\u901f\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u306e\u8a2d\u5b9a\u9805\u76ee<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>schedule<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u518d\u8a08\u7b97\u306e\u983b\u5ea6\uff08\u4f8b\uff1a<code>every 6 hours<\/code>\u3001<code>every 1 day<\/code>\uff09<\/td><\/tr><tr><td><code>mode<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u73fe\u6642\u70b9\u3067\u306f <code>relaxed<\/code> \u56fa\u5b9a\u3002\u591a\u5c11\u53e4\u304f\u3066\u3082\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f7f\u3046\u52d5\u4f5c<\/td><\/tr><tr><td><code>materialized_views<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u4e8b\u524d\u8a08\u7b97\u3059\u308b\u30d3\u30e5\u30fc\u306e\u30ea\u30b9\u30c8<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><code>materialized_views<\/code> \u306e\u5404\u8a2d\u5b9a\u9805\u76ee<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30d5\u30a3\u30fc\u30eb\u30c9<\/th><th>\u5fc5\u9808\/\u4efb\u610f<\/th><th>\u6982\u8981<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>\u5fc5\u9808<\/td><td>\u3053\u306e\u30de\u30c6\u30ea\u30a2\u30e9\u30a4\u30ba\u30c9\u30d3\u30e5\u30fc\u306e\u8b58\u5225\u540d<\/td><\/tr><tr><td><code>type<\/code><\/td><td>\u5fc5\u9808<\/td><td><code>aggregated<\/code>\uff08\u96c6\u8a08\u6e08\u307f\uff09\u304b <code>unaggregated<\/code>\uff08\u5143\u30c7\u30fc\u30bf\u306e\u307e\u307e\uff09\u304b<\/td><\/tr><tr><td><code>dimensions<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u4e8b\u524d\u8a08\u7b97\u3059\u308b dimension \u306e <code>name<\/code> \u3092\u5217\u6319\u3002<code>aggregated<\/code> \u3067 <code>measures<\/code> \u672a\u6307\u5b9a\u306a\u3089\u5fc5\u9808<\/td><\/tr><tr><td><code>measures<\/code><\/td><td>\u6761\u4ef6\u4ed8\u304d<\/td><td>\u4e8b\u524d\u8a08\u7b97\u3059\u308b measure \u306e <code>name<\/code> \u3092\u5217\u6319\u3002<code>aggregated<\/code> \u3067 <code>dimensions<\/code> \u672a\u6307\u5b9a\u306a\u3089\u5fc5\u9808<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>materialization:\n  schedule: every 1 day\n  mode: relaxed\n  materialized_views:\n    - name: raw_cache\n      type: unaggregated   # \u5143\u30c7\u30fc\u30bf\u3092\u4e38\u3054\u3068\u30ad\u30e3\u30c3\u30b7\u30e5\n\n    - name: daily_by_region\n      type: aggregated     # \u65e5\u5225\u00d7\u5730\u57df \u306e\u96c6\u8a08\u3092\u4e8b\u524d\u8a08\u7b97\n      dimensions:\n        - purchased_at\n        - store_region\n      measures:\n        - total_sales\n        - online_sales\n<\/code><\/pre>\n\n\n\n<p><code>unaggregated<\/code> \u306f\u30d9\u30fc\u30b9\u30e9\u30a4\u30f3\u3068\u3057\u3066\u5143\u30c7\u30fc\u30bf\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n\n\n\n<p><code>aggregated<\/code> \u306f\u3088\u304f\u4f7f\u3046\u96c6\u8a08\u7c92\u5ea6\u3092\u6307\u5b9a\u3057\u3066\u8a08\u7b97\u7d50\u679c\u3092\u4fdd\u5b58\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e21\u65b9\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Metric View YAML\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u9055\u3044\u306b\u3064\u3044\u3066<\/h2>\n\n\n\n<p>\u73fe\u5728\u306f <code>v0.1<\/code> \u3068 <code>v1.1<\/code> \u306e 2 \u3064\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>v0.1<\/strong>\uff1a\u521d\u671f\u30ea\u30ea\u30fc\u30b9\u7248\u3002<code>source<\/code>\u30fb<code>dimensions<\/code>\u30fb<code>measures<\/code>\u30fb<code>joins<\/code> \u306a\u3069\u57fa\u672c\u6a5f\u80fd\u304c\u4f7f\u3048\u308b<\/li>\n\n\n\n<li><strong>v1.1<\/strong>\uff1a<code>display_name<\/code>\u30fb<code>format<\/code>\u30fb<code>synonyms<\/code>\u30fb<code>comment<\/code> \u306a\u3069\u306e\u6a5f\u80fd\u304c\u8ffd\u52a0\u3002Genie \u3068\u9023\u643a\u3057\u3066\u81ea\u7136\u8a00\u8a9e\u5bfe\u5fdc\u3092\u5f37\u5316\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3061\u3089<\/li>\n<\/ul>\n\n\n\n<p>\u7279\u306b Genie \u3067\u81ea\u7136\u8a00\u8a9e\u306e\u8cea\u554f\u306b\u7684\u78ba\u306b\u7b54\u3048\u3055\u305b\u305f\u3044\u5834\u5408\u306f\u3001<code>v1.1<\/code> \u306b\u4e0a\u3052\u3066 <code>display_name<\/code> \u3068 <code>synonyms<\/code> \u3092\u3057\u3063\u304b\u308a\u8a2d\u5b9a\u3059\u308b\u306e\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Databricks Metric View\u306eYAML\u8a2d\u5b9a\u307e\u3068\u3081<\/h2>\n\n\n\n<p>Databricks Metric View \u306e YAML \u5b9a\u7fa9\u3092\u6574\u7406\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e 4 \u3064\u306e\u95a2\u5fc3\u4e8b\u306b\u5206\u3051\u3066\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4f55\u3092\u96c6\u8a08\u3059\u308b\u304b<\/strong>\uff08<code>source<\/code>\u30fb<code>joins<\/code>\uff09<\/li>\n\n\n\n<li><strong>\u3069\u3046\u5207\u308a\u5206\u3051\u308b\u304b<\/strong>\uff08<code>dimensions<\/code>\uff09<\/li>\n\n\n\n<li><strong>\u4f55\u3092\u8a08\u7b97\u3059\u308b\u304b<\/strong>\uff08<code>measures<\/code>\uff09<\/li>\n\n\n\n<li><strong>\u3069\u3046\u9ad8\u901f\u5316\u3059\u308b\u304b<\/strong>\uff08<code>materialization<\/code>\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u6700\u521d\u306f <code>source<\/code>\u30fb<code>dimensions<\/code>\u30fb<code>measures<\/code> \u3060\u3051\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6210\u304b\u3089\u59cb\u3081\u3066\u3001\u6163\u308c\u3066\u304d\u305f\u3089 <code>display_name<\/code>\u30fb<code>synonyms<\/code> \u3092\u52a0\u3048\u3066 Genie \u3068\u306e\u9023\u643a\u3092\u78e8\u3044\u3066\u3044\u304f\u306e\u304c\u5b9f\u8df5\u7684\u306a\u9032\u3081\u65b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>Metric View \u306e\u6982\u8981\u3084 Genie \u3068\u306e\u9023\u643a\u306b\u3064\u3044\u3066\u306f\u3001\u5225\u8a18\u4e8b\u3067\u3082\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002\u3042\u308f\u305b\u3066\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Databricks \u306e Metric View \u306f\u3001Unity Catalog \u4e0a\u3067 KPI \u3084\u696d\u7e3e\u6307\u6a19\u3092\u300c\u4e00\u304b\u6240\u3067\u5b9a\u7fa9\u30fb\u518d\u5229\u7528\u300d\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002 BI \u30c4\u30fc\u30eb\u3084 Genie \u306a\u3069\u8907\u6570\u306e\u5834\u6240\u304b\u3089\u540c\u3058\u6307\u6a19\u3092\u53c2\u7167\u3067\u304d [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":8530,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","swell_btn_cv_data":"","footnotes":"","_wp_rev_ctl_limit":""},"categories":[1,1251,1246],"tags":[774,1068,1286,794,993],"class_list":["post-8528","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","category-data-analysis","category-data-infrastructure","tag-databricks","tag-genie","tag-metric-view","tag-unity-catalog","tag-993"],"_links":{"self":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/8528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/comments?post=8528"}],"version-history":[{"count":1,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/8528\/revisions"}],"predecessor-version":[{"id":8529,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/8528\/revisions\/8529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media\/8530"}],"wp:attachment":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media?parent=8528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/categories?post=8528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/tags?post=8528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}