[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-databricks-databricks-metric-views":3,"mdc--k8rfxp-key":33,"related-repo-databricks-databricks-metric-views":2893,"related-org-databricks-databricks-metric-views":3013},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":31,"mdContent":32},"databricks-metric-views","manage Databricks Unity Catalog metric views","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.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"databricks","Databricks","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdatabricks.png",[12,16,19,20],{"name":13,"slug":14,"type":15},"Data Engineering","data-engineering","tag",{"name":17,"slug":18,"type":15},"KPI","kpi",{"name":9,"slug":8,"type":15},{"name":21,"slug":22,"type":15},"Analytics","analytics",204,"https:\u002F\u002Fgithub.com\u002Fdatabricks\u002Fdatabricks-agent-skills","2026-07-12T08:04:12.237759",null,60,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":26},[],"https:\u002F\u002Fgithub.com\u002Fdatabricks\u002Fdatabricks-agent-skills\u002Ftree\u002FHEAD\u002Fplugins\u002Fdatabricks\u002Fcopilot\u002Fskills\u002Fdatabricks-metric-views","---\nname: databricks-metric-views\ndescription: \"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.\"\ncompatibility: Requires databricks CLI (>= v1.0.0)\nmetadata:\n  version: \"0.1.0\"\nparent: databricks-core\n---\n\n# Unity Catalog Metric Views\n\nDefine reusable, governed business metrics in YAML that separate measure definitions from dimension groupings for flexible querying.\n\n## When to Use\n\nUse this skill when:\n- Defining **standardized business metrics** (revenue, order counts, conversion rates)\n- Building **KPI layers** shared across dashboards, Genie, and SQL queries\n- Creating metrics with **complex aggregations** (ratios, distinct counts, filtered measures)\n- Defining **window measures** (moving averages, running totals, period-over-period, YTD)\n- Modeling **star or snowflake schemas** with joins in metric definitions\n- Enabling **materialization** for pre-computed metric aggregations\n\n## Prerequisites\n\n- **Databricks Runtime 17.2+** (for YAML version 1.1); **17.3+** for semantic metadata (`synonyms` \u002F `display_name` \u002F `format`)\n- SQL warehouse with `CAN USE` permissions\n- `SELECT` on source tables, `CREATE TABLE` + `USE SCHEMA` in the target schema\n\n## Quick Start\n\n### Inspect Source Table Schema\n\nBefore authoring a metric view, inspect the source tables. Use `discover-schema` as the default — one call returns columns, types, sample rows, null counts, and row count. If you only know the schema, list tables first with `query \"SHOW TABLES IN ...\"`.\n\n`databricks experimental aitools tools discover-schema catalog.schema.orders catalog.schema.customers`\n\nFor dimensions and measures, probe distribution beyond sampling — cardinality of candidate dimensions, min\u002Fmax\u002Fpercentiles for measures, top categorical values. Write aggregate SQL through `databricks experimental aitools tools query --warehouse \u003CWH> \"...\"`. Both commands auto-pick the default warehouse; set `DATABRICKS_WAREHOUSE_ID` or pass `--warehouse \u003CID>` to override.\n\n> The `databricks experimental aitools tools` subcommands are experimental — subject to change between CLI versions. Confirm availability with `databricks experimental aitools tools --help` before relying on them; see [CLI Execution](#cli-execution) for the stable Statement Execution API fallback.\n\n### Create a Metric View\n\n```sql\nCREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  source: catalog.schema.orders\n  comment: \"Orders KPIs for sales analysis\"\n  filter: order_date > '2020-01-01'\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n      comment: \"Month of order\"\n    - name: Order Status\n      expr: CASE\n        WHEN status = 'O' THEN 'Open'\n        WHEN status = 'P' THEN 'Processing'\n        WHEN status = 'F' THEN 'Fulfilled'\n        END\n      comment: \"Human-readable order status\"\n  measures:\n    - name: Order Count\n      expr: COUNT(1)\n    - name: Total Revenue\n      expr: SUM(total_price)\n      comment: \"Sum of total price\"\n    - name: Revenue per Customer\n      expr: SUM(total_price) \u002F COUNT(DISTINCT customer_id)\n      comment: \"Average revenue per unique customer\"\n$$\n```\n\n### Query a Metric View\n\nAll measures must use the `MEASURE()` function. `SELECT *` is NOT supported.\n\n```sql\nSELECT\n  `Order Month`,\n  `Order Status`,\n  MEASURE(`Total Revenue`) AS total_revenue,\n  MEASURE(`Order Count`) AS order_count\nFROM catalog.schema.orders_metrics\nWHERE extract(year FROM `Order Month`) = 2024\nGROUP BY ALL\nORDER BY ALL\n```\n\n## Reference Files\n\n| Topic | File | Description |\n|-------|------|-------------|\n| YAML Syntax | [references\u002Fyaml-reference.md](references\u002Fyaml-reference.md) | Complete YAML spec: dimensions, measures, joins, materialization |\n| Patterns & Examples | [references\u002Fpatterns.md](references\u002Fpatterns.md) | Common patterns: star schema, snowflake, filtered measures, window measures, ratios |\n| Multi-source build (Advisor) | [references\u002Fmetric-view-advisor.md](references\u002Fmetric-view-advisor.md) | Guided workflow to build metric views from gold schemas, dashboards, SQL queries, Genie spaces, or KPI files — analysis, overlap detection, deploy |\n\n## Guided, multi-source build (Metric View Advisor)\n\nFor the single-table create\u002Fquery patterns above, use this skill directly. When the user wants to **build metric views from existing assets** — gold\u002Ffact schemas, AI\u002FBI dashboards, SQL query files, Genie spaces, or KPI spreadsheets — combine multiple sources, deduplicate against views that already exist, and walk deployment end to end, use the **Metric View Advisor** in [`references\u002Fmetric-view-advisor.md`](references\u002Fmetric-view-advisor.md). It builds on this skill's baseline spec and adds the multi-source analysis, overlap detection, and an interactive build\u002Fdeploy flow. Load it when the user asks to \"formalize our KPIs,\" \"build a metric\u002Fsemantic layer from our tables\u002Fdashboards\u002Fqueries,\" or otherwise wants a guided build rather than authoring one view by hand.\n\n## SQL Operations\n\n### Create Metric View\n\n```sql\nCREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  comment: \"Orders KPIs for sales analysis\"\n  source: catalog.schema.orders\n  filter: order_date > '2020-01-01'\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n      comment: \"Month of order\"\n    - name: Order Status\n      expr: status\n  measures:\n    - name: Order Count\n      expr: COUNT(1)\n    - name: Total Revenue\n      expr: SUM(total_price)\n      comment: \"Sum of total price\"\n$$;\n```\n\n### Query Metric View\n\n```sql\nSELECT\n  `Order Month`,\n  MEASURE(`Total Revenue`) AS total_revenue,\n  MEASURE(`Order Count`) AS order_count\nFROM catalog.schema.orders_metrics\nWHERE extract(year FROM `Order Month`) = 2024\nGROUP BY ALL\nORDER BY ALL\nLIMIT 100;\n```\n\n### Describe Metric View\n\n```sql\nDESCRIBE TABLE EXTENDED catalog.schema.orders_metrics;\n\n-- Or get YAML definition\nSHOW CREATE TABLE catalog.schema.orders_metrics;\n```\n\n### Grant Access\n\n```sql\nGRANT SELECT ON VIEW catalog.schema.orders_metrics TO `data-consumers`;\n```\n\n### Drop Metric View\n\n```sql\nDROP VIEW IF EXISTS catalog.schema.orders_metrics;\n```\n\n### CLI Execution\n\n> **The `databricks experimental aitools tools` commands are experimental and their surface can change between CLI versions.** Before relying on a subcommand (`query`, `statement submit`\u002F`get`, `discover-schema`, `get-default-warehouse`), confirm it exists with `databricks experimental aitools tools --help`, and fall back to the stable [Statement Execution API](#statement-execution-api-stable-alternative) below if it isn't available. There is no stable `databricks sql execute` \u002F `execute-statement` verb.\n\nFor **short** statements (`SHOW`\u002F`DESCRIBE`\u002F`SELECT`), run the SQL inline:\n\n```bash\ndatabricks experimental aitools tools query --warehouse WAREHOUSE_ID \"SHOW TABLES IN catalog.schema\"\n```\n\nFor **long DDL** (`CREATE OR REPLACE VIEW ... WITH METRICS LANGUAGE YAML AS $$...$$`), write the SQL to a `.sql` file and submit the file — this avoids the `$$`-heredoc escaping traps (bash variable expansion, `sed`, JSON encoding) entirely:\n\n```bash\n# orders_metrics.sql holds the full CREATE OR REPLACE VIEW ... $$ ... $$ statement\ndatabricks experimental aitools tools statement submit --file orders_metrics.sql --warehouse WAREHOUSE_ID\ndatabricks experimental aitools tools statement get \u003Cstatement_id>   # blocks until terminal\n```\n\nThis is the same file-based path the [Metric View Advisor](references\u002Fmetric-view-advisor.md) uses for deployment — keep to one method so the two don't drift.\n\n#### Statement Execution API (stable alternative)\n\nIf the experimental `aitools` commands aren't available, use the stable Statement Execution REST API, which takes the SQL as a JSON string:\n\n```bash\ndatabricks api post \u002Fapi\u002F2.0\u002Fsql\u002Fstatements\u002Fexecute --json '{\n  \"warehouse_id\": \"WAREHOUSE_ID\",\n  \"statement\": \"CREATE OR REPLACE VIEW catalog.schema.orders_metrics WITH METRICS LANGUAGE YAML AS $$\\nversion: 1.1\\nsource: catalog.schema.orders\\ndimensions:\\n  - name: Order Month\\n    expr: DATE_TRUNC(MONTH, order_date)\\nmeasures:\\n  - name: Total Revenue\\n    expr: SUM(total_price)\\n$$\"\n}'\n```\n\nFor long statements, template the JSON from a `.sql` file rather than hand-escaping newlines.\n\n### Convert an Existing View to a Metric View\n\nTo migrate a regular view to a metric view, treat its `SELECT` source as the metric view's `source`, then promote `GROUP BY` columns to `dimensions` and aggregations to `measures`. The new metric view does not replace the original — it sits alongside it as a governed metric layer.\n\n```sql\n-- Existing regular view (keep as-is or drop later)\n-- CREATE VIEW catalog.schema.orders_summary AS\n-- SELECT DATE_TRUNC('MONTH', order_date) AS month,\n--        SUM(total_price) AS revenue,\n--        COUNT(*) AS order_count\n-- FROM catalog.schema.orders\n-- GROUP BY 1;\n\n-- Equivalent metric view (new artifact, governed)\nCREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  source: catalog.schema.orders\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n  measures:\n    - name: Revenue\n      expr: SUM(total_price)\n    - name: Order Count\n      expr: COUNT(1)\n$$\n```\n\nAfter verifying parity (`SELECT ... FROM \u003Corders_metrics>` returns the same numbers as the original view), update downstream consumers and drop the original view.\n\n## YAML Spec Quick Reference\n\n```yaml\nversion: 1.1                    # Required: \"1.1\" for DBR 17.2+ (semantic metadata needs 17.3+)\nsource: catalog.schema.table    # Required: source table\u002Fview\ncomment: \"Description\"          # Optional: metric view description\nfilter: column > value          # Optional: global WHERE filter\n\ndimensions:                     # Required: at least one\n  - name: Display Name          # Backtick-quoted in queries\n    expr: sql_expression        # Column ref or SQL transformation\n    comment: \"Description\"      # Optional (v1.1+)\n\nmeasures:                       # Required: at least one\n  - name: Display Name          # Queried via MEASURE(`name`)\n    expr: AGG_FUNC(column)      # Must be an aggregate expression\n    comment: \"Description\"      # Optional (v1.1+)\n\njoins:                          # Optional: star\u002Fsnowflake schema\n  - name: dim_table\n    source: catalog.schema.dim_table\n    on: source.fk = dim_table.pk\n\nmaterialization:                # Optional (experimental)\n  schedule: every 6 hours\n  mode: relaxed\n```\n\n## Key Concepts\n\n### Dimensions vs Measures\n\n| | Dimensions | Measures |\n|---|---|---|\n| **Purpose** | Categorize and group data | Aggregate numeric values |\n| **Examples** | Region, Date, Status | SUM(revenue), COUNT(orders) |\n| **In queries** | Used in SELECT and GROUP BY | Wrapped in `MEASURE()` |\n| **SQL expressions** | Any SQL expression | Must use aggregate functions |\n\n### Why Metric Views vs Standard Views?\n\n| Feature | Standard Views | Metric Views |\n|---------|---------------|--------------|\n| Aggregation locked at creation | Yes | No - flexible at query time |\n| Safe re-aggregation of ratios | No | Yes |\n| Star\u002Fsnowflake schema joins | Manual | Declarative in YAML |\n| Materialization | Separate MV needed | Built-in |\n| AI\u002FBI Genie integration | Limited | Native |\n\n## Common Issues\n\n| Issue | Solution |\n|-------|----------|\n| **SELECT * not supported** | Must explicitly list dimensions and use MEASURE() for measures |\n| **\"Cannot resolve column\"** | Dimension\u002Fmeasure names with spaces need backtick quoting |\n| **JOIN at query time fails** | Joins must be in the YAML definition, not in the SELECT query |\n| **MEASURE() required** | All measure references must be wrapped: `MEASURE(\\`name\\`)` |\n| **DBR version error** | Requires Runtime 17.2+ for YAML v1.1, or 16.4+ for v0.1. Semantic metadata (`synonyms`\u002F`display_name`\u002F`format`) needs 17.3+ |\n| **Materialization not working** | Requires serverless compute enabled; currently experimental |\n\n## Integrations\n\nMetric views work natively with:\n- **AI\u002FBI Dashboards** - Use as datasets for visualizations\n- **AI\u002FBI Genie** - Natural language querying of metrics\n- **Alerts** - Set threshold-based alerts on measures\n- **SQL Editor** - Direct SQL querying with MEASURE()\n- **Catalog Explorer UI** - Visual creation and browsing\n\n## Resources\n\n- [Metric Views Documentation](https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002F)\n- [YAML Syntax Reference](https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fdata-modeling\u002Fsyntax)\n- [Joins](https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fdata-modeling\u002Fjoins)\n- [Window Measures](https:\u002F\u002Fdocs.databricks.com\u002Fmetric-views\u002Fdata-modeling\u002Fwindow-measures) (Experimental)\n- [Materialization](https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fmaterialization)\n- [MEASURE() Function](https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fsql\u002Flanguage-manual\u002Ffunctions\u002Fmeasure)\n",{"data":34,"body":39},{"name":4,"description":6,"compatibility":35,"metadata":36,"parent":38},"Requires databricks CLI (>= v1.0.0)",{"version":37},"0.1.0","databricks-core",{"type":40,"children":41},"root",[42,51,57,64,69,146,152,236,242,249,270,279,308,342,348,622,628,649,728,734,830,836,865,871,877,1033,1039,1110,1116,1156,1162,1176,1182,1196,1201,1287,1320,1384,1427,1545,1556,1563,1576,1649,1661,1667,1711,1895,1908,1914,2353,2359,2365,2479,2485,2601,2607,2752,2758,2763,2816,2822,2887],{"type":43,"tag":44,"props":45,"children":47},"element","h1",{"id":46},"unity-catalog-metric-views",[48],{"type":49,"value":50},"text","Unity Catalog Metric Views",{"type":43,"tag":52,"props":53,"children":54},"p",{},[55],{"type":49,"value":56},"Define reusable, governed business metrics in YAML that separate measure definitions from dimension groupings for flexible querying.",{"type":43,"tag":58,"props":59,"children":61},"h2",{"id":60},"when-to-use",[62],{"type":49,"value":63},"When to Use",{"type":43,"tag":52,"props":65,"children":66},{},[67],{"type":49,"value":68},"Use this skill when:",{"type":43,"tag":70,"props":71,"children":72},"ul",{},[73,87,99,111,122,134],{"type":43,"tag":74,"props":75,"children":76},"li",{},[77,79,85],{"type":49,"value":78},"Defining ",{"type":43,"tag":80,"props":81,"children":82},"strong",{},[83],{"type":49,"value":84},"standardized business metrics",{"type":49,"value":86}," (revenue, order counts, conversion rates)",{"type":43,"tag":74,"props":88,"children":89},{},[90,92,97],{"type":49,"value":91},"Building ",{"type":43,"tag":80,"props":93,"children":94},{},[95],{"type":49,"value":96},"KPI layers",{"type":49,"value":98}," shared across dashboards, Genie, and SQL queries",{"type":43,"tag":74,"props":100,"children":101},{},[102,104,109],{"type":49,"value":103},"Creating metrics with ",{"type":43,"tag":80,"props":105,"children":106},{},[107],{"type":49,"value":108},"complex aggregations",{"type":49,"value":110}," (ratios, distinct counts, filtered measures)",{"type":43,"tag":74,"props":112,"children":113},{},[114,115,120],{"type":49,"value":78},{"type":43,"tag":80,"props":116,"children":117},{},[118],{"type":49,"value":119},"window measures",{"type":49,"value":121}," (moving averages, running totals, period-over-period, YTD)",{"type":43,"tag":74,"props":123,"children":124},{},[125,127,132],{"type":49,"value":126},"Modeling ",{"type":43,"tag":80,"props":128,"children":129},{},[130],{"type":49,"value":131},"star or snowflake schemas",{"type":49,"value":133}," with joins in metric definitions",{"type":43,"tag":74,"props":135,"children":136},{},[137,139,144],{"type":49,"value":138},"Enabling ",{"type":43,"tag":80,"props":140,"children":141},{},[142],{"type":49,"value":143},"materialization",{"type":49,"value":145}," for pre-computed metric aggregations",{"type":43,"tag":58,"props":147,"children":149},{"id":148},"prerequisites",[150],{"type":49,"value":151},"Prerequisites",{"type":43,"tag":70,"props":153,"children":154},{},[155,196,209],{"type":43,"tag":74,"props":156,"children":157},{},[158,163,165,170,172,179,181,187,188,194],{"type":43,"tag":80,"props":159,"children":160},{},[161],{"type":49,"value":162},"Databricks Runtime 17.2+",{"type":49,"value":164}," (for YAML version 1.1); ",{"type":43,"tag":80,"props":166,"children":167},{},[168],{"type":49,"value":169},"17.3+",{"type":49,"value":171}," for semantic metadata (",{"type":43,"tag":173,"props":174,"children":176},"code",{"className":175},[],[177],{"type":49,"value":178},"synonyms",{"type":49,"value":180}," \u002F ",{"type":43,"tag":173,"props":182,"children":184},{"className":183},[],[185],{"type":49,"value":186},"display_name",{"type":49,"value":180},{"type":43,"tag":173,"props":189,"children":191},{"className":190},[],[192],{"type":49,"value":193},"format",{"type":49,"value":195},")",{"type":43,"tag":74,"props":197,"children":198},{},[199,201,207],{"type":49,"value":200},"SQL warehouse with ",{"type":43,"tag":173,"props":202,"children":204},{"className":203},[],[205],{"type":49,"value":206},"CAN USE",{"type":49,"value":208}," permissions",{"type":43,"tag":74,"props":210,"children":211},{},[212,218,220,226,228,234],{"type":43,"tag":173,"props":213,"children":215},{"className":214},[],[216],{"type":49,"value":217},"SELECT",{"type":49,"value":219}," on source tables, ",{"type":43,"tag":173,"props":221,"children":223},{"className":222},[],[224],{"type":49,"value":225},"CREATE TABLE",{"type":49,"value":227}," + ",{"type":43,"tag":173,"props":229,"children":231},{"className":230},[],[232],{"type":49,"value":233},"USE SCHEMA",{"type":49,"value":235}," in the target schema",{"type":43,"tag":58,"props":237,"children":239},{"id":238},"quick-start",[240],{"type":49,"value":241},"Quick Start",{"type":43,"tag":243,"props":244,"children":246},"h3",{"id":245},"inspect-source-table-schema",[247],{"type":49,"value":248},"Inspect Source Table Schema",{"type":43,"tag":52,"props":250,"children":251},{},[252,254,260,262,268],{"type":49,"value":253},"Before authoring a metric view, inspect the source tables. Use ",{"type":43,"tag":173,"props":255,"children":257},{"className":256},[],[258],{"type":49,"value":259},"discover-schema",{"type":49,"value":261}," as the default — one call returns columns, types, sample rows, null counts, and row count. If you only know the schema, list tables first with ",{"type":43,"tag":173,"props":263,"children":265},{"className":264},[],[266],{"type":49,"value":267},"query \"SHOW TABLES IN ...\"",{"type":49,"value":269},".",{"type":43,"tag":52,"props":271,"children":272},{},[273],{"type":43,"tag":173,"props":274,"children":276},{"className":275},[],[277],{"type":49,"value":278},"databricks experimental aitools tools discover-schema catalog.schema.orders catalog.schema.customers",{"type":43,"tag":52,"props":280,"children":281},{},[282,284,290,292,298,300,306],{"type":49,"value":283},"For dimensions and measures, probe distribution beyond sampling — cardinality of candidate dimensions, min\u002Fmax\u002Fpercentiles for measures, top categorical values. Write aggregate SQL through ",{"type":43,"tag":173,"props":285,"children":287},{"className":286},[],[288],{"type":49,"value":289},"databricks experimental aitools tools query --warehouse \u003CWH> \"...\"",{"type":49,"value":291},". Both commands auto-pick the default warehouse; set ",{"type":43,"tag":173,"props":293,"children":295},{"className":294},[],[296],{"type":49,"value":297},"DATABRICKS_WAREHOUSE_ID",{"type":49,"value":299}," or pass ",{"type":43,"tag":173,"props":301,"children":303},{"className":302},[],[304],{"type":49,"value":305},"--warehouse \u003CID>",{"type":49,"value":307}," to override.",{"type":43,"tag":309,"props":310,"children":311},"blockquote",{},[312],{"type":43,"tag":52,"props":313,"children":314},{},[315,317,323,325,331,333,340],{"type":49,"value":316},"The ",{"type":43,"tag":173,"props":318,"children":320},{"className":319},[],[321],{"type":49,"value":322},"databricks experimental aitools tools",{"type":49,"value":324}," subcommands are experimental — subject to change between CLI versions. Confirm availability with ",{"type":43,"tag":173,"props":326,"children":328},{"className":327},[],[329],{"type":49,"value":330},"databricks experimental aitools tools --help",{"type":49,"value":332}," before relying on them; see ",{"type":43,"tag":334,"props":335,"children":337},"a",{"href":336},"#cli-execution",[338],{"type":49,"value":339},"CLI Execution",{"type":49,"value":341}," for the stable Statement Execution API fallback.",{"type":43,"tag":243,"props":343,"children":345},{"id":344},"create-a-metric-view",[346],{"type":49,"value":347},"Create a Metric View",{"type":43,"tag":349,"props":350,"children":355},"pre",{"className":351,"code":352,"language":353,"meta":354,"style":354},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","CREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  source: catalog.schema.orders\n  comment: \"Orders KPIs for sales analysis\"\n  filter: order_date > '2020-01-01'\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n      comment: \"Month of order\"\n    - name: Order Status\n      expr: CASE\n        WHEN status = 'O' THEN 'Open'\n        WHEN status = 'P' THEN 'Processing'\n        WHEN status = 'F' THEN 'Fulfilled'\n        END\n      comment: \"Human-readable order status\"\n  measures:\n    - name: Order Count\n      expr: COUNT(1)\n    - name: Total Revenue\n      expr: SUM(total_price)\n      comment: \"Sum of total price\"\n    - name: Revenue per Customer\n      expr: SUM(total_price) \u002F COUNT(DISTINCT customer_id)\n      comment: \"Average revenue per unique customer\"\n$$\n","sql","",[356],{"type":43,"tag":173,"props":357,"children":358},{"__ignoreMap":354},[359,370,379,388,397,406,415,424,433,442,451,460,469,478,487,496,505,514,523,532,541,550,559,568,577,586,595,604,613],{"type":43,"tag":360,"props":361,"children":364},"span",{"class":362,"line":363},"line",1,[365],{"type":43,"tag":360,"props":366,"children":367},{},[368],{"type":49,"value":369},"CREATE OR REPLACE VIEW catalog.schema.orders_metrics\n",{"type":43,"tag":360,"props":371,"children":373},{"class":362,"line":372},2,[374],{"type":43,"tag":360,"props":375,"children":376},{},[377],{"type":49,"value":378},"WITH METRICS\n",{"type":43,"tag":360,"props":380,"children":382},{"class":362,"line":381},3,[383],{"type":43,"tag":360,"props":384,"children":385},{},[386],{"type":49,"value":387},"LANGUAGE YAML\n",{"type":43,"tag":360,"props":389,"children":391},{"class":362,"line":390},4,[392],{"type":43,"tag":360,"props":393,"children":394},{},[395],{"type":49,"value":396},"AS $$\n",{"type":43,"tag":360,"props":398,"children":400},{"class":362,"line":399},5,[401],{"type":43,"tag":360,"props":402,"children":403},{},[404],{"type":49,"value":405},"  version: 1.1\n",{"type":43,"tag":360,"props":407,"children":409},{"class":362,"line":408},6,[410],{"type":43,"tag":360,"props":411,"children":412},{},[413],{"type":49,"value":414},"  source: catalog.schema.orders\n",{"type":43,"tag":360,"props":416,"children":418},{"class":362,"line":417},7,[419],{"type":43,"tag":360,"props":420,"children":421},{},[422],{"type":49,"value":423},"  comment: \"Orders KPIs for sales analysis\"\n",{"type":43,"tag":360,"props":425,"children":427},{"class":362,"line":426},8,[428],{"type":43,"tag":360,"props":429,"children":430},{},[431],{"type":49,"value":432},"  filter: order_date > '2020-01-01'\n",{"type":43,"tag":360,"props":434,"children":436},{"class":362,"line":435},9,[437],{"type":43,"tag":360,"props":438,"children":439},{},[440],{"type":49,"value":441},"  dimensions:\n",{"type":43,"tag":360,"props":443,"children":445},{"class":362,"line":444},10,[446],{"type":43,"tag":360,"props":447,"children":448},{},[449],{"type":49,"value":450},"    - name: Order Month\n",{"type":43,"tag":360,"props":452,"children":454},{"class":362,"line":453},11,[455],{"type":43,"tag":360,"props":456,"children":457},{},[458],{"type":49,"value":459},"      expr: DATE_TRUNC('MONTH', order_date)\n",{"type":43,"tag":360,"props":461,"children":463},{"class":362,"line":462},12,[464],{"type":43,"tag":360,"props":465,"children":466},{},[467],{"type":49,"value":468},"      comment: \"Month of order\"\n",{"type":43,"tag":360,"props":470,"children":472},{"class":362,"line":471},13,[473],{"type":43,"tag":360,"props":474,"children":475},{},[476],{"type":49,"value":477},"    - name: Order Status\n",{"type":43,"tag":360,"props":479,"children":481},{"class":362,"line":480},14,[482],{"type":43,"tag":360,"props":483,"children":484},{},[485],{"type":49,"value":486},"      expr: CASE\n",{"type":43,"tag":360,"props":488,"children":490},{"class":362,"line":489},15,[491],{"type":43,"tag":360,"props":492,"children":493},{},[494],{"type":49,"value":495},"        WHEN status = 'O' THEN 'Open'\n",{"type":43,"tag":360,"props":497,"children":499},{"class":362,"line":498},16,[500],{"type":43,"tag":360,"props":501,"children":502},{},[503],{"type":49,"value":504},"        WHEN status = 'P' THEN 'Processing'\n",{"type":43,"tag":360,"props":506,"children":508},{"class":362,"line":507},17,[509],{"type":43,"tag":360,"props":510,"children":511},{},[512],{"type":49,"value":513},"        WHEN status = 'F' THEN 'Fulfilled'\n",{"type":43,"tag":360,"props":515,"children":517},{"class":362,"line":516},18,[518],{"type":43,"tag":360,"props":519,"children":520},{},[521],{"type":49,"value":522},"        END\n",{"type":43,"tag":360,"props":524,"children":526},{"class":362,"line":525},19,[527],{"type":43,"tag":360,"props":528,"children":529},{},[530],{"type":49,"value":531},"      comment: \"Human-readable order status\"\n",{"type":43,"tag":360,"props":533,"children":535},{"class":362,"line":534},20,[536],{"type":43,"tag":360,"props":537,"children":538},{},[539],{"type":49,"value":540},"  measures:\n",{"type":43,"tag":360,"props":542,"children":544},{"class":362,"line":543},21,[545],{"type":43,"tag":360,"props":546,"children":547},{},[548],{"type":49,"value":549},"    - name: Order Count\n",{"type":43,"tag":360,"props":551,"children":553},{"class":362,"line":552},22,[554],{"type":43,"tag":360,"props":555,"children":556},{},[557],{"type":49,"value":558},"      expr: COUNT(1)\n",{"type":43,"tag":360,"props":560,"children":562},{"class":362,"line":561},23,[563],{"type":43,"tag":360,"props":564,"children":565},{},[566],{"type":49,"value":567},"    - name: Total Revenue\n",{"type":43,"tag":360,"props":569,"children":571},{"class":362,"line":570},24,[572],{"type":43,"tag":360,"props":573,"children":574},{},[575],{"type":49,"value":576},"      expr: SUM(total_price)\n",{"type":43,"tag":360,"props":578,"children":580},{"class":362,"line":579},25,[581],{"type":43,"tag":360,"props":582,"children":583},{},[584],{"type":49,"value":585},"      comment: \"Sum of total price\"\n",{"type":43,"tag":360,"props":587,"children":589},{"class":362,"line":588},26,[590],{"type":43,"tag":360,"props":591,"children":592},{},[593],{"type":49,"value":594},"    - name: Revenue per Customer\n",{"type":43,"tag":360,"props":596,"children":598},{"class":362,"line":597},27,[599],{"type":43,"tag":360,"props":600,"children":601},{},[602],{"type":49,"value":603},"      expr: SUM(total_price) \u002F COUNT(DISTINCT customer_id)\n",{"type":43,"tag":360,"props":605,"children":607},{"class":362,"line":606},28,[608],{"type":43,"tag":360,"props":609,"children":610},{},[611],{"type":49,"value":612},"      comment: \"Average revenue per unique customer\"\n",{"type":43,"tag":360,"props":614,"children":616},{"class":362,"line":615},29,[617],{"type":43,"tag":360,"props":618,"children":619},{},[620],{"type":49,"value":621},"$$\n",{"type":43,"tag":243,"props":623,"children":625},{"id":624},"query-a-metric-view",[626],{"type":49,"value":627},"Query a Metric View",{"type":43,"tag":52,"props":629,"children":630},{},[631,633,639,641,647],{"type":49,"value":632},"All measures must use the ",{"type":43,"tag":173,"props":634,"children":636},{"className":635},[],[637],{"type":49,"value":638},"MEASURE()",{"type":49,"value":640}," function. ",{"type":43,"tag":173,"props":642,"children":644},{"className":643},[],[645],{"type":49,"value":646},"SELECT *",{"type":49,"value":648}," is NOT supported.",{"type":43,"tag":349,"props":650,"children":652},{"className":351,"code":651,"language":353,"meta":354,"style":354},"SELECT\n  `Order Month`,\n  `Order Status`,\n  MEASURE(`Total Revenue`) AS total_revenue,\n  MEASURE(`Order Count`) AS order_count\nFROM catalog.schema.orders_metrics\nWHERE extract(year FROM `Order Month`) = 2024\nGROUP BY ALL\nORDER BY ALL\n",[653],{"type":43,"tag":173,"props":654,"children":655},{"__ignoreMap":354},[656,664,672,680,688,696,704,712,720],{"type":43,"tag":360,"props":657,"children":658},{"class":362,"line":363},[659],{"type":43,"tag":360,"props":660,"children":661},{},[662],{"type":49,"value":663},"SELECT\n",{"type":43,"tag":360,"props":665,"children":666},{"class":362,"line":372},[667],{"type":43,"tag":360,"props":668,"children":669},{},[670],{"type":49,"value":671},"  `Order Month`,\n",{"type":43,"tag":360,"props":673,"children":674},{"class":362,"line":381},[675],{"type":43,"tag":360,"props":676,"children":677},{},[678],{"type":49,"value":679},"  `Order Status`,\n",{"type":43,"tag":360,"props":681,"children":682},{"class":362,"line":390},[683],{"type":43,"tag":360,"props":684,"children":685},{},[686],{"type":49,"value":687},"  MEASURE(`Total Revenue`) AS total_revenue,\n",{"type":43,"tag":360,"props":689,"children":690},{"class":362,"line":399},[691],{"type":43,"tag":360,"props":692,"children":693},{},[694],{"type":49,"value":695},"  MEASURE(`Order Count`) AS order_count\n",{"type":43,"tag":360,"props":697,"children":698},{"class":362,"line":408},[699],{"type":43,"tag":360,"props":700,"children":701},{},[702],{"type":49,"value":703},"FROM catalog.schema.orders_metrics\n",{"type":43,"tag":360,"props":705,"children":706},{"class":362,"line":417},[707],{"type":43,"tag":360,"props":708,"children":709},{},[710],{"type":49,"value":711},"WHERE extract(year FROM `Order Month`) = 2024\n",{"type":43,"tag":360,"props":713,"children":714},{"class":362,"line":426},[715],{"type":43,"tag":360,"props":716,"children":717},{},[718],{"type":49,"value":719},"GROUP BY ALL\n",{"type":43,"tag":360,"props":721,"children":722},{"class":362,"line":435},[723],{"type":43,"tag":360,"props":724,"children":725},{},[726],{"type":49,"value":727},"ORDER BY ALL\n",{"type":43,"tag":58,"props":729,"children":731},{"id":730},"reference-files",[732],{"type":49,"value":733},"Reference Files",{"type":43,"tag":735,"props":736,"children":737},"table",{},[738,762],{"type":43,"tag":739,"props":740,"children":741},"thead",{},[742],{"type":43,"tag":743,"props":744,"children":745},"tr",{},[746,752,757],{"type":43,"tag":747,"props":748,"children":749},"th",{},[750],{"type":49,"value":751},"Topic",{"type":43,"tag":747,"props":753,"children":754},{},[755],{"type":49,"value":756},"File",{"type":43,"tag":747,"props":758,"children":759},{},[760],{"type":49,"value":761},"Description",{"type":43,"tag":763,"props":764,"children":765},"tbody",{},[766,788,809],{"type":43,"tag":743,"props":767,"children":768},{},[769,775,783],{"type":43,"tag":770,"props":771,"children":772},"td",{},[773],{"type":49,"value":774},"YAML Syntax",{"type":43,"tag":770,"props":776,"children":777},{},[778],{"type":43,"tag":334,"props":779,"children":781},{"href":780},"references\u002Fyaml-reference.md",[782],{"type":49,"value":780},{"type":43,"tag":770,"props":784,"children":785},{},[786],{"type":49,"value":787},"Complete YAML spec: dimensions, measures, joins, materialization",{"type":43,"tag":743,"props":789,"children":790},{},[791,796,804],{"type":43,"tag":770,"props":792,"children":793},{},[794],{"type":49,"value":795},"Patterns & Examples",{"type":43,"tag":770,"props":797,"children":798},{},[799],{"type":43,"tag":334,"props":800,"children":802},{"href":801},"references\u002Fpatterns.md",[803],{"type":49,"value":801},{"type":43,"tag":770,"props":805,"children":806},{},[807],{"type":49,"value":808},"Common patterns: star schema, snowflake, filtered measures, window measures, ratios",{"type":43,"tag":743,"props":810,"children":811},{},[812,817,825],{"type":43,"tag":770,"props":813,"children":814},{},[815],{"type":49,"value":816},"Multi-source build (Advisor)",{"type":43,"tag":770,"props":818,"children":819},{},[820],{"type":43,"tag":334,"props":821,"children":823},{"href":822},"references\u002Fmetric-view-advisor.md",[824],{"type":49,"value":822},{"type":43,"tag":770,"props":826,"children":827},{},[828],{"type":49,"value":829},"Guided workflow to build metric views from gold schemas, dashboards, SQL queries, Genie spaces, or KPI files — analysis, overlap detection, deploy",{"type":43,"tag":58,"props":831,"children":833},{"id":832},"guided-multi-source-build-metric-view-advisor",[834],{"type":49,"value":835},"Guided, multi-source build (Metric View Advisor)",{"type":43,"tag":52,"props":837,"children":838},{},[839,841,846,848,853,855,863],{"type":49,"value":840},"For the single-table create\u002Fquery patterns above, use this skill directly. When the user wants to ",{"type":43,"tag":80,"props":842,"children":843},{},[844],{"type":49,"value":845},"build metric views from existing assets",{"type":49,"value":847}," — gold\u002Ffact schemas, AI\u002FBI dashboards, SQL query files, Genie spaces, or KPI spreadsheets — combine multiple sources, deduplicate against views that already exist, and walk deployment end to end, use the ",{"type":43,"tag":80,"props":849,"children":850},{},[851],{"type":49,"value":852},"Metric View Advisor",{"type":49,"value":854}," in ",{"type":43,"tag":334,"props":856,"children":857},{"href":822},[858],{"type":43,"tag":173,"props":859,"children":861},{"className":860},[],[862],{"type":49,"value":822},{"type":49,"value":864},". It builds on this skill's baseline spec and adds the multi-source analysis, overlap detection, and an interactive build\u002Fdeploy flow. Load it when the user asks to \"formalize our KPIs,\" \"build a metric\u002Fsemantic layer from our tables\u002Fdashboards\u002Fqueries,\" or otherwise wants a guided build rather than authoring one view by hand.",{"type":43,"tag":58,"props":866,"children":868},{"id":867},"sql-operations",[869],{"type":49,"value":870},"SQL Operations",{"type":43,"tag":243,"props":872,"children":874},{"id":873},"create-metric-view",[875],{"type":49,"value":876},"Create Metric View",{"type":43,"tag":349,"props":878,"children":880},{"className":351,"code":879,"language":353,"meta":354,"style":354},"CREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  comment: \"Orders KPIs for sales analysis\"\n  source: catalog.schema.orders\n  filter: order_date > '2020-01-01'\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n      comment: \"Month of order\"\n    - name: Order Status\n      expr: status\n  measures:\n    - name: Order Count\n      expr: COUNT(1)\n    - name: Total Revenue\n      expr: SUM(total_price)\n      comment: \"Sum of total price\"\n$$;\n",[881],{"type":43,"tag":173,"props":882,"children":883},{"__ignoreMap":354},[884,891,898,905,912,919,926,933,940,947,954,961,968,975,983,990,997,1004,1011,1018,1025],{"type":43,"tag":360,"props":885,"children":886},{"class":362,"line":363},[887],{"type":43,"tag":360,"props":888,"children":889},{},[890],{"type":49,"value":369},{"type":43,"tag":360,"props":892,"children":893},{"class":362,"line":372},[894],{"type":43,"tag":360,"props":895,"children":896},{},[897],{"type":49,"value":378},{"type":43,"tag":360,"props":899,"children":900},{"class":362,"line":381},[901],{"type":43,"tag":360,"props":902,"children":903},{},[904],{"type":49,"value":387},{"type":43,"tag":360,"props":906,"children":907},{"class":362,"line":390},[908],{"type":43,"tag":360,"props":909,"children":910},{},[911],{"type":49,"value":396},{"type":43,"tag":360,"props":913,"children":914},{"class":362,"line":399},[915],{"type":43,"tag":360,"props":916,"children":917},{},[918],{"type":49,"value":405},{"type":43,"tag":360,"props":920,"children":921},{"class":362,"line":408},[922],{"type":43,"tag":360,"props":923,"children":924},{},[925],{"type":49,"value":423},{"type":43,"tag":360,"props":927,"children":928},{"class":362,"line":417},[929],{"type":43,"tag":360,"props":930,"children":931},{},[932],{"type":49,"value":414},{"type":43,"tag":360,"props":934,"children":935},{"class":362,"line":426},[936],{"type":43,"tag":360,"props":937,"children":938},{},[939],{"type":49,"value":432},{"type":43,"tag":360,"props":941,"children":942},{"class":362,"line":435},[943],{"type":43,"tag":360,"props":944,"children":945},{},[946],{"type":49,"value":441},{"type":43,"tag":360,"props":948,"children":949},{"class":362,"line":444},[950],{"type":43,"tag":360,"props":951,"children":952},{},[953],{"type":49,"value":450},{"type":43,"tag":360,"props":955,"children":956},{"class":362,"line":453},[957],{"type":43,"tag":360,"props":958,"children":959},{},[960],{"type":49,"value":459},{"type":43,"tag":360,"props":962,"children":963},{"class":362,"line":462},[964],{"type":43,"tag":360,"props":965,"children":966},{},[967],{"type":49,"value":468},{"type":43,"tag":360,"props":969,"children":970},{"class":362,"line":471},[971],{"type":43,"tag":360,"props":972,"children":973},{},[974],{"type":49,"value":477},{"type":43,"tag":360,"props":976,"children":977},{"class":362,"line":480},[978],{"type":43,"tag":360,"props":979,"children":980},{},[981],{"type":49,"value":982},"      expr: status\n",{"type":43,"tag":360,"props":984,"children":985},{"class":362,"line":489},[986],{"type":43,"tag":360,"props":987,"children":988},{},[989],{"type":49,"value":540},{"type":43,"tag":360,"props":991,"children":992},{"class":362,"line":498},[993],{"type":43,"tag":360,"props":994,"children":995},{},[996],{"type":49,"value":549},{"type":43,"tag":360,"props":998,"children":999},{"class":362,"line":507},[1000],{"type":43,"tag":360,"props":1001,"children":1002},{},[1003],{"type":49,"value":558},{"type":43,"tag":360,"props":1005,"children":1006},{"class":362,"line":516},[1007],{"type":43,"tag":360,"props":1008,"children":1009},{},[1010],{"type":49,"value":567},{"type":43,"tag":360,"props":1012,"children":1013},{"class":362,"line":525},[1014],{"type":43,"tag":360,"props":1015,"children":1016},{},[1017],{"type":49,"value":576},{"type":43,"tag":360,"props":1019,"children":1020},{"class":362,"line":534},[1021],{"type":43,"tag":360,"props":1022,"children":1023},{},[1024],{"type":49,"value":585},{"type":43,"tag":360,"props":1026,"children":1027},{"class":362,"line":543},[1028],{"type":43,"tag":360,"props":1029,"children":1030},{},[1031],{"type":49,"value":1032},"$$;\n",{"type":43,"tag":243,"props":1034,"children":1036},{"id":1035},"query-metric-view",[1037],{"type":49,"value":1038},"Query Metric View",{"type":43,"tag":349,"props":1040,"children":1042},{"className":351,"code":1041,"language":353,"meta":354,"style":354},"SELECT\n  `Order Month`,\n  MEASURE(`Total Revenue`) AS total_revenue,\n  MEASURE(`Order Count`) AS order_count\nFROM catalog.schema.orders_metrics\nWHERE extract(year FROM `Order Month`) = 2024\nGROUP BY ALL\nORDER BY ALL\nLIMIT 100;\n",[1043],{"type":43,"tag":173,"props":1044,"children":1045},{"__ignoreMap":354},[1046,1053,1060,1067,1074,1081,1088,1095,1102],{"type":43,"tag":360,"props":1047,"children":1048},{"class":362,"line":363},[1049],{"type":43,"tag":360,"props":1050,"children":1051},{},[1052],{"type":49,"value":663},{"type":43,"tag":360,"props":1054,"children":1055},{"class":362,"line":372},[1056],{"type":43,"tag":360,"props":1057,"children":1058},{},[1059],{"type":49,"value":671},{"type":43,"tag":360,"props":1061,"children":1062},{"class":362,"line":381},[1063],{"type":43,"tag":360,"props":1064,"children":1065},{},[1066],{"type":49,"value":687},{"type":43,"tag":360,"props":1068,"children":1069},{"class":362,"line":390},[1070],{"type":43,"tag":360,"props":1071,"children":1072},{},[1073],{"type":49,"value":695},{"type":43,"tag":360,"props":1075,"children":1076},{"class":362,"line":399},[1077],{"type":43,"tag":360,"props":1078,"children":1079},{},[1080],{"type":49,"value":703},{"type":43,"tag":360,"props":1082,"children":1083},{"class":362,"line":408},[1084],{"type":43,"tag":360,"props":1085,"children":1086},{},[1087],{"type":49,"value":711},{"type":43,"tag":360,"props":1089,"children":1090},{"class":362,"line":417},[1091],{"type":43,"tag":360,"props":1092,"children":1093},{},[1094],{"type":49,"value":719},{"type":43,"tag":360,"props":1096,"children":1097},{"class":362,"line":426},[1098],{"type":43,"tag":360,"props":1099,"children":1100},{},[1101],{"type":49,"value":727},{"type":43,"tag":360,"props":1103,"children":1104},{"class":362,"line":435},[1105],{"type":43,"tag":360,"props":1106,"children":1107},{},[1108],{"type":49,"value":1109},"LIMIT 100;\n",{"type":43,"tag":243,"props":1111,"children":1113},{"id":1112},"describe-metric-view",[1114],{"type":49,"value":1115},"Describe Metric View",{"type":43,"tag":349,"props":1117,"children":1119},{"className":351,"code":1118,"language":353,"meta":354,"style":354},"DESCRIBE TABLE EXTENDED catalog.schema.orders_metrics;\n\n-- Or get YAML definition\nSHOW CREATE TABLE catalog.schema.orders_metrics;\n",[1120],{"type":43,"tag":173,"props":1121,"children":1122},{"__ignoreMap":354},[1123,1131,1140,1148],{"type":43,"tag":360,"props":1124,"children":1125},{"class":362,"line":363},[1126],{"type":43,"tag":360,"props":1127,"children":1128},{},[1129],{"type":49,"value":1130},"DESCRIBE TABLE EXTENDED catalog.schema.orders_metrics;\n",{"type":43,"tag":360,"props":1132,"children":1133},{"class":362,"line":372},[1134],{"type":43,"tag":360,"props":1135,"children":1137},{"emptyLinePlaceholder":1136},true,[1138],{"type":49,"value":1139},"\n",{"type":43,"tag":360,"props":1141,"children":1142},{"class":362,"line":381},[1143],{"type":43,"tag":360,"props":1144,"children":1145},{},[1146],{"type":49,"value":1147},"-- Or get YAML definition\n",{"type":43,"tag":360,"props":1149,"children":1150},{"class":362,"line":390},[1151],{"type":43,"tag":360,"props":1152,"children":1153},{},[1154],{"type":49,"value":1155},"SHOW CREATE TABLE catalog.schema.orders_metrics;\n",{"type":43,"tag":243,"props":1157,"children":1159},{"id":1158},"grant-access",[1160],{"type":49,"value":1161},"Grant Access",{"type":43,"tag":349,"props":1163,"children":1165},{"className":351,"code":1164,"language":353,"meta":354,"style":354},"GRANT SELECT ON VIEW catalog.schema.orders_metrics TO `data-consumers`;\n",[1166],{"type":43,"tag":173,"props":1167,"children":1168},{"__ignoreMap":354},[1169],{"type":43,"tag":360,"props":1170,"children":1171},{"class":362,"line":363},[1172],{"type":43,"tag":360,"props":1173,"children":1174},{},[1175],{"type":49,"value":1164},{"type":43,"tag":243,"props":1177,"children":1179},{"id":1178},"drop-metric-view",[1180],{"type":49,"value":1181},"Drop Metric View",{"type":43,"tag":349,"props":1183,"children":1185},{"className":351,"code":1184,"language":353,"meta":354,"style":354},"DROP VIEW IF EXISTS catalog.schema.orders_metrics;\n",[1186],{"type":43,"tag":173,"props":1187,"children":1188},{"__ignoreMap":354},[1189],{"type":43,"tag":360,"props":1190,"children":1191},{"class":362,"line":363},[1192],{"type":43,"tag":360,"props":1193,"children":1194},{},[1195],{"type":49,"value":1184},{"type":43,"tag":243,"props":1197,"children":1199},{"id":1198},"cli-execution",[1200],{"type":49,"value":339},{"type":43,"tag":309,"props":1202,"children":1203},{},[1204],{"type":43,"tag":52,"props":1205,"children":1206},{},[1207,1218,1220,1226,1228,1234,1236,1242,1243,1248,1249,1255,1257,1262,1264,1270,1272,1278,1279,1285],{"type":43,"tag":80,"props":1208,"children":1209},{},[1210,1211,1216],{"type":49,"value":316},{"type":43,"tag":173,"props":1212,"children":1214},{"className":1213},[],[1215],{"type":49,"value":322},{"type":49,"value":1217}," commands are experimental and their surface can change between CLI versions.",{"type":49,"value":1219}," Before relying on a subcommand (",{"type":43,"tag":173,"props":1221,"children":1223},{"className":1222},[],[1224],{"type":49,"value":1225},"query",{"type":49,"value":1227},", ",{"type":43,"tag":173,"props":1229,"children":1231},{"className":1230},[],[1232],{"type":49,"value":1233},"statement submit",{"type":49,"value":1235},"\u002F",{"type":43,"tag":173,"props":1237,"children":1239},{"className":1238},[],[1240],{"type":49,"value":1241},"get",{"type":49,"value":1227},{"type":43,"tag":173,"props":1244,"children":1246},{"className":1245},[],[1247],{"type":49,"value":259},{"type":49,"value":1227},{"type":43,"tag":173,"props":1250,"children":1252},{"className":1251},[],[1253],{"type":49,"value":1254},"get-default-warehouse",{"type":49,"value":1256},"), confirm it exists with ",{"type":43,"tag":173,"props":1258,"children":1260},{"className":1259},[],[1261],{"type":49,"value":330},{"type":49,"value":1263},", and fall back to the stable ",{"type":43,"tag":334,"props":1265,"children":1267},{"href":1266},"#statement-execution-api-stable-alternative",[1268],{"type":49,"value":1269},"Statement Execution API",{"type":49,"value":1271}," below if it isn't available. There is no stable ",{"type":43,"tag":173,"props":1273,"children":1275},{"className":1274},[],[1276],{"type":49,"value":1277},"databricks sql execute",{"type":49,"value":180},{"type":43,"tag":173,"props":1280,"children":1282},{"className":1281},[],[1283],{"type":49,"value":1284},"execute-statement",{"type":49,"value":1286}," verb.",{"type":43,"tag":52,"props":1288,"children":1289},{},[1290,1292,1297,1299,1305,1306,1312,1313,1318],{"type":49,"value":1291},"For ",{"type":43,"tag":80,"props":1293,"children":1294},{},[1295],{"type":49,"value":1296},"short",{"type":49,"value":1298}," statements (",{"type":43,"tag":173,"props":1300,"children":1302},{"className":1301},[],[1303],{"type":49,"value":1304},"SHOW",{"type":49,"value":1235},{"type":43,"tag":173,"props":1307,"children":1309},{"className":1308},[],[1310],{"type":49,"value":1311},"DESCRIBE",{"type":49,"value":1235},{"type":43,"tag":173,"props":1314,"children":1316},{"className":1315},[],[1317],{"type":49,"value":217},{"type":49,"value":1319},"), run the SQL inline:",{"type":43,"tag":349,"props":1321,"children":1325},{"className":1322,"code":1323,"language":1324,"meta":354,"style":354},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","databricks experimental aitools tools query --warehouse WAREHOUSE_ID \"SHOW TABLES IN catalog.schema\"\n","bash",[1326],{"type":43,"tag":173,"props":1327,"children":1328},{"__ignoreMap":354},[1329],{"type":43,"tag":360,"props":1330,"children":1331},{"class":362,"line":363},[1332,1337,1343,1348,1353,1358,1363,1368,1374,1379],{"type":43,"tag":360,"props":1333,"children":1335},{"style":1334},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1336],{"type":49,"value":8},{"type":43,"tag":360,"props":1338,"children":1340},{"style":1339},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[1341],{"type":49,"value":1342}," experimental",{"type":43,"tag":360,"props":1344,"children":1345},{"style":1339},[1346],{"type":49,"value":1347}," aitools",{"type":43,"tag":360,"props":1349,"children":1350},{"style":1339},[1351],{"type":49,"value":1352}," tools",{"type":43,"tag":360,"props":1354,"children":1355},{"style":1339},[1356],{"type":49,"value":1357}," query",{"type":43,"tag":360,"props":1359,"children":1360},{"style":1339},[1361],{"type":49,"value":1362}," --warehouse",{"type":43,"tag":360,"props":1364,"children":1365},{"style":1339},[1366],{"type":49,"value":1367}," WAREHOUSE_ID",{"type":43,"tag":360,"props":1369,"children":1371},{"style":1370},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[1372],{"type":49,"value":1373}," \"",{"type":43,"tag":360,"props":1375,"children":1376},{"style":1339},[1377],{"type":49,"value":1378},"SHOW TABLES IN catalog.schema",{"type":43,"tag":360,"props":1380,"children":1381},{"style":1370},[1382],{"type":49,"value":1383},"\"\n",{"type":43,"tag":52,"props":1385,"children":1386},{},[1387,1388,1393,1395,1401,1403,1409,1411,1417,1419,1425],{"type":49,"value":1291},{"type":43,"tag":80,"props":1389,"children":1390},{},[1391],{"type":49,"value":1392},"long DDL",{"type":49,"value":1394}," (",{"type":43,"tag":173,"props":1396,"children":1398},{"className":1397},[],[1399],{"type":49,"value":1400},"CREATE OR REPLACE VIEW ... WITH METRICS LANGUAGE YAML AS $$...$$",{"type":49,"value":1402},"), write the SQL to a ",{"type":43,"tag":173,"props":1404,"children":1406},{"className":1405},[],[1407],{"type":49,"value":1408},".sql",{"type":49,"value":1410}," file and submit the file — this avoids the ",{"type":43,"tag":173,"props":1412,"children":1414},{"className":1413},[],[1415],{"type":49,"value":1416},"$$",{"type":49,"value":1418},"-heredoc escaping traps (bash variable expansion, ",{"type":43,"tag":173,"props":1420,"children":1422},{"className":1421},[],[1423],{"type":49,"value":1424},"sed",{"type":49,"value":1426},", JSON encoding) entirely:",{"type":43,"tag":349,"props":1428,"children":1430},{"className":1322,"code":1429,"language":1324,"meta":354,"style":354},"# orders_metrics.sql holds the full CREATE OR REPLACE VIEW ... $$ ... $$ statement\ndatabricks experimental aitools tools statement submit --file orders_metrics.sql --warehouse WAREHOUSE_ID\ndatabricks experimental aitools tools statement get \u003Cstatement_id>   # blocks until terminal\n",[1431],{"type":43,"tag":173,"props":1432,"children":1433},{"__ignoreMap":354},[1434,1443,1491],{"type":43,"tag":360,"props":1435,"children":1436},{"class":362,"line":363},[1437],{"type":43,"tag":360,"props":1438,"children":1440},{"style":1439},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[1441],{"type":49,"value":1442},"# orders_metrics.sql holds the full CREATE OR REPLACE VIEW ... $$ ... $$ statement\n",{"type":43,"tag":360,"props":1444,"children":1445},{"class":362,"line":372},[1446,1450,1454,1458,1462,1467,1472,1477,1482,1486],{"type":43,"tag":360,"props":1447,"children":1448},{"style":1334},[1449],{"type":49,"value":8},{"type":43,"tag":360,"props":1451,"children":1452},{"style":1339},[1453],{"type":49,"value":1342},{"type":43,"tag":360,"props":1455,"children":1456},{"style":1339},[1457],{"type":49,"value":1347},{"type":43,"tag":360,"props":1459,"children":1460},{"style":1339},[1461],{"type":49,"value":1352},{"type":43,"tag":360,"props":1463,"children":1464},{"style":1339},[1465],{"type":49,"value":1466}," statement",{"type":43,"tag":360,"props":1468,"children":1469},{"style":1339},[1470],{"type":49,"value":1471}," submit",{"type":43,"tag":360,"props":1473,"children":1474},{"style":1339},[1475],{"type":49,"value":1476}," --file",{"type":43,"tag":360,"props":1478,"children":1479},{"style":1339},[1480],{"type":49,"value":1481}," orders_metrics.sql",{"type":43,"tag":360,"props":1483,"children":1484},{"style":1339},[1485],{"type":49,"value":1362},{"type":43,"tag":360,"props":1487,"children":1488},{"style":1339},[1489],{"type":49,"value":1490}," WAREHOUSE_ID\n",{"type":43,"tag":360,"props":1492,"children":1493},{"class":362,"line":381},[1494,1498,1502,1506,1510,1514,1519,1524,1529,1535,1540],{"type":43,"tag":360,"props":1495,"children":1496},{"style":1334},[1497],{"type":49,"value":8},{"type":43,"tag":360,"props":1499,"children":1500},{"style":1339},[1501],{"type":49,"value":1342},{"type":43,"tag":360,"props":1503,"children":1504},{"style":1339},[1505],{"type":49,"value":1347},{"type":43,"tag":360,"props":1507,"children":1508},{"style":1339},[1509],{"type":49,"value":1352},{"type":43,"tag":360,"props":1511,"children":1512},{"style":1339},[1513],{"type":49,"value":1466},{"type":43,"tag":360,"props":1515,"children":1516},{"style":1339},[1517],{"type":49,"value":1518}," get",{"type":43,"tag":360,"props":1520,"children":1521},{"style":1370},[1522],{"type":49,"value":1523}," \u003C",{"type":43,"tag":360,"props":1525,"children":1526},{"style":1339},[1527],{"type":49,"value":1528},"statement_i",{"type":43,"tag":360,"props":1530,"children":1532},{"style":1531},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[1533],{"type":49,"value":1534},"d",{"type":43,"tag":360,"props":1536,"children":1537},{"style":1370},[1538],{"type":49,"value":1539},">",{"type":43,"tag":360,"props":1541,"children":1542},{"style":1439},[1543],{"type":49,"value":1544},"   # blocks until terminal\n",{"type":43,"tag":52,"props":1546,"children":1547},{},[1548,1550,1554],{"type":49,"value":1549},"This is the same file-based path the ",{"type":43,"tag":334,"props":1551,"children":1552},{"href":822},[1553],{"type":49,"value":852},{"type":49,"value":1555}," uses for deployment — keep to one method so the two don't drift.",{"type":43,"tag":1557,"props":1558,"children":1560},"h4",{"id":1559},"statement-execution-api-stable-alternative",[1561],{"type":49,"value":1562},"Statement Execution API (stable alternative)",{"type":43,"tag":52,"props":1564,"children":1565},{},[1566,1568,1574],{"type":49,"value":1567},"If the experimental ",{"type":43,"tag":173,"props":1569,"children":1571},{"className":1570},[],[1572],{"type":49,"value":1573},"aitools",{"type":49,"value":1575}," commands aren't available, use the stable Statement Execution REST API, which takes the SQL as a JSON string:",{"type":43,"tag":349,"props":1577,"children":1579},{"className":1322,"code":1578,"language":1324,"meta":354,"style":354},"databricks api post \u002Fapi\u002F2.0\u002Fsql\u002Fstatements\u002Fexecute --json '{\n  \"warehouse_id\": \"WAREHOUSE_ID\",\n  \"statement\": \"CREATE OR REPLACE VIEW catalog.schema.orders_metrics WITH METRICS LANGUAGE YAML AS $$\\nversion: 1.1\\nsource: catalog.schema.orders\\ndimensions:\\n  - name: Order Month\\n    expr: DATE_TRUNC(MONTH, order_date)\\nmeasures:\\n  - name: Total Revenue\\n    expr: SUM(total_price)\\n$$\"\n}'\n",[1580],{"type":43,"tag":173,"props":1581,"children":1582},{"__ignoreMap":354},[1583,1620,1628,1636],{"type":43,"tag":360,"props":1584,"children":1585},{"class":362,"line":363},[1586,1590,1595,1600,1605,1610,1615],{"type":43,"tag":360,"props":1587,"children":1588},{"style":1334},[1589],{"type":49,"value":8},{"type":43,"tag":360,"props":1591,"children":1592},{"style":1339},[1593],{"type":49,"value":1594}," api",{"type":43,"tag":360,"props":1596,"children":1597},{"style":1339},[1598],{"type":49,"value":1599}," post",{"type":43,"tag":360,"props":1601,"children":1602},{"style":1339},[1603],{"type":49,"value":1604}," \u002Fapi\u002F2.0\u002Fsql\u002Fstatements\u002Fexecute",{"type":43,"tag":360,"props":1606,"children":1607},{"style":1339},[1608],{"type":49,"value":1609}," --json",{"type":43,"tag":360,"props":1611,"children":1612},{"style":1370},[1613],{"type":49,"value":1614}," '",{"type":43,"tag":360,"props":1616,"children":1617},{"style":1339},[1618],{"type":49,"value":1619},"{\n",{"type":43,"tag":360,"props":1621,"children":1622},{"class":362,"line":372},[1623],{"type":43,"tag":360,"props":1624,"children":1625},{"style":1339},[1626],{"type":49,"value":1627},"  \"warehouse_id\": \"WAREHOUSE_ID\",\n",{"type":43,"tag":360,"props":1629,"children":1630},{"class":362,"line":381},[1631],{"type":43,"tag":360,"props":1632,"children":1633},{"style":1339},[1634],{"type":49,"value":1635},"  \"statement\": \"CREATE OR REPLACE VIEW catalog.schema.orders_metrics WITH METRICS LANGUAGE YAML AS $$\\nversion: 1.1\\nsource: catalog.schema.orders\\ndimensions:\\n  - name: Order Month\\n    expr: DATE_TRUNC(MONTH, order_date)\\nmeasures:\\n  - name: Total Revenue\\n    expr: SUM(total_price)\\n$$\"\n",{"type":43,"tag":360,"props":1637,"children":1638},{"class":362,"line":390},[1639,1644],{"type":43,"tag":360,"props":1640,"children":1641},{"style":1339},[1642],{"type":49,"value":1643},"}",{"type":43,"tag":360,"props":1645,"children":1646},{"style":1370},[1647],{"type":49,"value":1648},"'\n",{"type":43,"tag":52,"props":1650,"children":1651},{},[1652,1654,1659],{"type":49,"value":1653},"For long statements, template the JSON from a ",{"type":43,"tag":173,"props":1655,"children":1657},{"className":1656},[],[1658],{"type":49,"value":1408},{"type":49,"value":1660}," file rather than hand-escaping newlines.",{"type":43,"tag":243,"props":1662,"children":1664},{"id":1663},"convert-an-existing-view-to-a-metric-view",[1665],{"type":49,"value":1666},"Convert an Existing View to a Metric View",{"type":43,"tag":52,"props":1668,"children":1669},{},[1670,1672,1677,1679,1685,1687,1693,1695,1701,1703,1709],{"type":49,"value":1671},"To migrate a regular view to a metric view, treat its ",{"type":43,"tag":173,"props":1673,"children":1675},{"className":1674},[],[1676],{"type":49,"value":217},{"type":49,"value":1678}," source as the metric view's ",{"type":43,"tag":173,"props":1680,"children":1682},{"className":1681},[],[1683],{"type":49,"value":1684},"source",{"type":49,"value":1686},", then promote ",{"type":43,"tag":173,"props":1688,"children":1690},{"className":1689},[],[1691],{"type":49,"value":1692},"GROUP BY",{"type":49,"value":1694}," columns to ",{"type":43,"tag":173,"props":1696,"children":1698},{"className":1697},[],[1699],{"type":49,"value":1700},"dimensions",{"type":49,"value":1702}," and aggregations to ",{"type":43,"tag":173,"props":1704,"children":1706},{"className":1705},[],[1707],{"type":49,"value":1708},"measures",{"type":49,"value":1710},". The new metric view does not replace the original — it sits alongside it as a governed metric layer.",{"type":43,"tag":349,"props":1712,"children":1714},{"className":351,"code":1713,"language":353,"meta":354,"style":354},"-- Existing regular view (keep as-is or drop later)\n-- CREATE VIEW catalog.schema.orders_summary AS\n-- SELECT DATE_TRUNC('MONTH', order_date) AS month,\n--        SUM(total_price) AS revenue,\n--        COUNT(*) AS order_count\n-- FROM catalog.schema.orders\n-- GROUP BY 1;\n\n-- Equivalent metric view (new artifact, governed)\nCREATE OR REPLACE VIEW catalog.schema.orders_metrics\nWITH METRICS\nLANGUAGE YAML\nAS $$\n  version: 1.1\n  source: catalog.schema.orders\n  dimensions:\n    - name: Order Month\n      expr: DATE_TRUNC('MONTH', order_date)\n  measures:\n    - name: Revenue\n      expr: SUM(total_price)\n    - name: Order Count\n      expr: COUNT(1)\n$$\n",[1715],{"type":43,"tag":173,"props":1716,"children":1717},{"__ignoreMap":354},[1718,1726,1734,1742,1750,1758,1766,1774,1781,1789,1796,1803,1810,1817,1824,1831,1838,1845,1852,1859,1867,1874,1881,1888],{"type":43,"tag":360,"props":1719,"children":1720},{"class":362,"line":363},[1721],{"type":43,"tag":360,"props":1722,"children":1723},{},[1724],{"type":49,"value":1725},"-- Existing regular view (keep as-is or drop later)\n",{"type":43,"tag":360,"props":1727,"children":1728},{"class":362,"line":372},[1729],{"type":43,"tag":360,"props":1730,"children":1731},{},[1732],{"type":49,"value":1733},"-- CREATE VIEW catalog.schema.orders_summary AS\n",{"type":43,"tag":360,"props":1735,"children":1736},{"class":362,"line":381},[1737],{"type":43,"tag":360,"props":1738,"children":1739},{},[1740],{"type":49,"value":1741},"-- SELECT DATE_TRUNC('MONTH', order_date) AS month,\n",{"type":43,"tag":360,"props":1743,"children":1744},{"class":362,"line":390},[1745],{"type":43,"tag":360,"props":1746,"children":1747},{},[1748],{"type":49,"value":1749},"--        SUM(total_price) AS revenue,\n",{"type":43,"tag":360,"props":1751,"children":1752},{"class":362,"line":399},[1753],{"type":43,"tag":360,"props":1754,"children":1755},{},[1756],{"type":49,"value":1757},"--        COUNT(*) AS order_count\n",{"type":43,"tag":360,"props":1759,"children":1760},{"class":362,"line":408},[1761],{"type":43,"tag":360,"props":1762,"children":1763},{},[1764],{"type":49,"value":1765},"-- FROM catalog.schema.orders\n",{"type":43,"tag":360,"props":1767,"children":1768},{"class":362,"line":417},[1769],{"type":43,"tag":360,"props":1770,"children":1771},{},[1772],{"type":49,"value":1773},"-- GROUP BY 1;\n",{"type":43,"tag":360,"props":1775,"children":1776},{"class":362,"line":426},[1777],{"type":43,"tag":360,"props":1778,"children":1779},{"emptyLinePlaceholder":1136},[1780],{"type":49,"value":1139},{"type":43,"tag":360,"props":1782,"children":1783},{"class":362,"line":435},[1784],{"type":43,"tag":360,"props":1785,"children":1786},{},[1787],{"type":49,"value":1788},"-- Equivalent metric view (new artifact, governed)\n",{"type":43,"tag":360,"props":1790,"children":1791},{"class":362,"line":444},[1792],{"type":43,"tag":360,"props":1793,"children":1794},{},[1795],{"type":49,"value":369},{"type":43,"tag":360,"props":1797,"children":1798},{"class":362,"line":453},[1799],{"type":43,"tag":360,"props":1800,"children":1801},{},[1802],{"type":49,"value":378},{"type":43,"tag":360,"props":1804,"children":1805},{"class":362,"line":462},[1806],{"type":43,"tag":360,"props":1807,"children":1808},{},[1809],{"type":49,"value":387},{"type":43,"tag":360,"props":1811,"children":1812},{"class":362,"line":471},[1813],{"type":43,"tag":360,"props":1814,"children":1815},{},[1816],{"type":49,"value":396},{"type":43,"tag":360,"props":1818,"children":1819},{"class":362,"line":480},[1820],{"type":43,"tag":360,"props":1821,"children":1822},{},[1823],{"type":49,"value":405},{"type":43,"tag":360,"props":1825,"children":1826},{"class":362,"line":489},[1827],{"type":43,"tag":360,"props":1828,"children":1829},{},[1830],{"type":49,"value":414},{"type":43,"tag":360,"props":1832,"children":1833},{"class":362,"line":498},[1834],{"type":43,"tag":360,"props":1835,"children":1836},{},[1837],{"type":49,"value":441},{"type":43,"tag":360,"props":1839,"children":1840},{"class":362,"line":507},[1841],{"type":43,"tag":360,"props":1842,"children":1843},{},[1844],{"type":49,"value":450},{"type":43,"tag":360,"props":1846,"children":1847},{"class":362,"line":516},[1848],{"type":43,"tag":360,"props":1849,"children":1850},{},[1851],{"type":49,"value":459},{"type":43,"tag":360,"props":1853,"children":1854},{"class":362,"line":525},[1855],{"type":43,"tag":360,"props":1856,"children":1857},{},[1858],{"type":49,"value":540},{"type":43,"tag":360,"props":1860,"children":1861},{"class":362,"line":534},[1862],{"type":43,"tag":360,"props":1863,"children":1864},{},[1865],{"type":49,"value":1866},"    - name: Revenue\n",{"type":43,"tag":360,"props":1868,"children":1869},{"class":362,"line":543},[1870],{"type":43,"tag":360,"props":1871,"children":1872},{},[1873],{"type":49,"value":576},{"type":43,"tag":360,"props":1875,"children":1876},{"class":362,"line":552},[1877],{"type":43,"tag":360,"props":1878,"children":1879},{},[1880],{"type":49,"value":549},{"type":43,"tag":360,"props":1882,"children":1883},{"class":362,"line":561},[1884],{"type":43,"tag":360,"props":1885,"children":1886},{},[1887],{"type":49,"value":558},{"type":43,"tag":360,"props":1889,"children":1890},{"class":362,"line":570},[1891],{"type":43,"tag":360,"props":1892,"children":1893},{},[1894],{"type":49,"value":621},{"type":43,"tag":52,"props":1896,"children":1897},{},[1898,1900,1906],{"type":49,"value":1899},"After verifying parity (",{"type":43,"tag":173,"props":1901,"children":1903},{"className":1902},[],[1904],{"type":49,"value":1905},"SELECT ... FROM \u003Corders_metrics>",{"type":49,"value":1907}," returns the same numbers as the original view), update downstream consumers and drop the original view.",{"type":43,"tag":58,"props":1909,"children":1911},{"id":1910},"yaml-spec-quick-reference",[1912],{"type":49,"value":1913},"YAML Spec Quick Reference",{"type":43,"tag":349,"props":1915,"children":1919},{"className":1916,"code":1917,"language":1918,"meta":354,"style":354},"language-yaml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","version: 1.1                    # Required: \"1.1\" for DBR 17.2+ (semantic metadata needs 17.3+)\nsource: catalog.schema.table    # Required: source table\u002Fview\ncomment: \"Description\"          # Optional: metric view description\nfilter: column > value          # Optional: global WHERE filter\n\ndimensions:                     # Required: at least one\n  - name: Display Name          # Backtick-quoted in queries\n    expr: sql_expression        # Column ref or SQL transformation\n    comment: \"Description\"      # Optional (v1.1+)\n\nmeasures:                       # Required: at least one\n  - name: Display Name          # Queried via MEASURE(`name`)\n    expr: AGG_FUNC(column)      # Must be an aggregate expression\n    comment: \"Description\"      # Optional (v1.1+)\n\njoins:                          # Optional: star\u002Fsnowflake schema\n  - name: dim_table\n    source: catalog.schema.dim_table\n    on: source.fk = dim_table.pk\n\nmaterialization:                # Optional (experimental)\n  schedule: every 6 hours\n  mode: relaxed\n","yaml",[1920],{"type":43,"tag":173,"props":1921,"children":1922},{"__ignoreMap":354},[1923,1948,1969,1999,2021,2028,2044,2071,2093,2122,2129,2145,2169,2190,2217,2224,2241,2261,2278,2296,2303,2319,2336],{"type":43,"tag":360,"props":1924,"children":1925},{"class":362,"line":363},[1926,1932,1937,1943],{"type":43,"tag":360,"props":1927,"children":1929},{"style":1928},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[1930],{"type":49,"value":1931},"version",{"type":43,"tag":360,"props":1933,"children":1934},{"style":1370},[1935],{"type":49,"value":1936},":",{"type":43,"tag":360,"props":1938,"children":1940},{"style":1939},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1941],{"type":49,"value":1942}," 1.1",{"type":43,"tag":360,"props":1944,"children":1945},{"style":1439},[1946],{"type":49,"value":1947},"                    # Required: \"1.1\" for DBR 17.2+ (semantic metadata needs 17.3+)\n",{"type":43,"tag":360,"props":1949,"children":1950},{"class":362,"line":372},[1951,1955,1959,1964],{"type":43,"tag":360,"props":1952,"children":1953},{"style":1928},[1954],{"type":49,"value":1684},{"type":43,"tag":360,"props":1956,"children":1957},{"style":1370},[1958],{"type":49,"value":1936},{"type":43,"tag":360,"props":1960,"children":1961},{"style":1339},[1962],{"type":49,"value":1963}," catalog.schema.table",{"type":43,"tag":360,"props":1965,"children":1966},{"style":1439},[1967],{"type":49,"value":1968},"    # Required: source table\u002Fview\n",{"type":43,"tag":360,"props":1970,"children":1971},{"class":362,"line":381},[1972,1977,1981,1985,1989,1994],{"type":43,"tag":360,"props":1973,"children":1974},{"style":1928},[1975],{"type":49,"value":1976},"comment",{"type":43,"tag":360,"props":1978,"children":1979},{"style":1370},[1980],{"type":49,"value":1936},{"type":43,"tag":360,"props":1982,"children":1983},{"style":1370},[1984],{"type":49,"value":1373},{"type":43,"tag":360,"props":1986,"children":1987},{"style":1339},[1988],{"type":49,"value":761},{"type":43,"tag":360,"props":1990,"children":1991},{"style":1370},[1992],{"type":49,"value":1993},"\"",{"type":43,"tag":360,"props":1995,"children":1996},{"style":1439},[1997],{"type":49,"value":1998},"          # Optional: metric view description\n",{"type":43,"tag":360,"props":2000,"children":2001},{"class":362,"line":390},[2002,2007,2011,2016],{"type":43,"tag":360,"props":2003,"children":2004},{"style":1928},[2005],{"type":49,"value":2006},"filter",{"type":43,"tag":360,"props":2008,"children":2009},{"style":1370},[2010],{"type":49,"value":1936},{"type":43,"tag":360,"props":2012,"children":2013},{"style":1339},[2014],{"type":49,"value":2015}," column > value",{"type":43,"tag":360,"props":2017,"children":2018},{"style":1439},[2019],{"type":49,"value":2020},"          # Optional: global WHERE filter\n",{"type":43,"tag":360,"props":2022,"children":2023},{"class":362,"line":399},[2024],{"type":43,"tag":360,"props":2025,"children":2026},{"emptyLinePlaceholder":1136},[2027],{"type":49,"value":1139},{"type":43,"tag":360,"props":2029,"children":2030},{"class":362,"line":408},[2031,2035,2039],{"type":43,"tag":360,"props":2032,"children":2033},{"style":1928},[2034],{"type":49,"value":1700},{"type":43,"tag":360,"props":2036,"children":2037},{"style":1370},[2038],{"type":49,"value":1936},{"type":43,"tag":360,"props":2040,"children":2041},{"style":1439},[2042],{"type":49,"value":2043},"                     # Required: at least one\n",{"type":43,"tag":360,"props":2045,"children":2046},{"class":362,"line":417},[2047,2052,2057,2061,2066],{"type":43,"tag":360,"props":2048,"children":2049},{"style":1370},[2050],{"type":49,"value":2051},"  -",{"type":43,"tag":360,"props":2053,"children":2054},{"style":1928},[2055],{"type":49,"value":2056}," name",{"type":43,"tag":360,"props":2058,"children":2059},{"style":1370},[2060],{"type":49,"value":1936},{"type":43,"tag":360,"props":2062,"children":2063},{"style":1339},[2064],{"type":49,"value":2065}," Display Name",{"type":43,"tag":360,"props":2067,"children":2068},{"style":1439},[2069],{"type":49,"value":2070},"          # Backtick-quoted in queries\n",{"type":43,"tag":360,"props":2072,"children":2073},{"class":362,"line":426},[2074,2079,2083,2088],{"type":43,"tag":360,"props":2075,"children":2076},{"style":1928},[2077],{"type":49,"value":2078},"    expr",{"type":43,"tag":360,"props":2080,"children":2081},{"style":1370},[2082],{"type":49,"value":1936},{"type":43,"tag":360,"props":2084,"children":2085},{"style":1339},[2086],{"type":49,"value":2087}," sql_expression",{"type":43,"tag":360,"props":2089,"children":2090},{"style":1439},[2091],{"type":49,"value":2092},"        # Column ref or SQL transformation\n",{"type":43,"tag":360,"props":2094,"children":2095},{"class":362,"line":435},[2096,2101,2105,2109,2113,2117],{"type":43,"tag":360,"props":2097,"children":2098},{"style":1928},[2099],{"type":49,"value":2100},"    comment",{"type":43,"tag":360,"props":2102,"children":2103},{"style":1370},[2104],{"type":49,"value":1936},{"type":43,"tag":360,"props":2106,"children":2107},{"style":1370},[2108],{"type":49,"value":1373},{"type":43,"tag":360,"props":2110,"children":2111},{"style":1339},[2112],{"type":49,"value":761},{"type":43,"tag":360,"props":2114,"children":2115},{"style":1370},[2116],{"type":49,"value":1993},{"type":43,"tag":360,"props":2118,"children":2119},{"style":1439},[2120],{"type":49,"value":2121},"      # Optional (v1.1+)\n",{"type":43,"tag":360,"props":2123,"children":2124},{"class":362,"line":444},[2125],{"type":43,"tag":360,"props":2126,"children":2127},{"emptyLinePlaceholder":1136},[2128],{"type":49,"value":1139},{"type":43,"tag":360,"props":2130,"children":2131},{"class":362,"line":453},[2132,2136,2140],{"type":43,"tag":360,"props":2133,"children":2134},{"style":1928},[2135],{"type":49,"value":1708},{"type":43,"tag":360,"props":2137,"children":2138},{"style":1370},[2139],{"type":49,"value":1936},{"type":43,"tag":360,"props":2141,"children":2142},{"style":1439},[2143],{"type":49,"value":2144},"                       # Required: at least one\n",{"type":43,"tag":360,"props":2146,"children":2147},{"class":362,"line":462},[2148,2152,2156,2160,2164],{"type":43,"tag":360,"props":2149,"children":2150},{"style":1370},[2151],{"type":49,"value":2051},{"type":43,"tag":360,"props":2153,"children":2154},{"style":1928},[2155],{"type":49,"value":2056},{"type":43,"tag":360,"props":2157,"children":2158},{"style":1370},[2159],{"type":49,"value":1936},{"type":43,"tag":360,"props":2161,"children":2162},{"style":1339},[2163],{"type":49,"value":2065},{"type":43,"tag":360,"props":2165,"children":2166},{"style":1439},[2167],{"type":49,"value":2168},"          # Queried via MEASURE(`name`)\n",{"type":43,"tag":360,"props":2170,"children":2171},{"class":362,"line":471},[2172,2176,2180,2185],{"type":43,"tag":360,"props":2173,"children":2174},{"style":1928},[2175],{"type":49,"value":2078},{"type":43,"tag":360,"props":2177,"children":2178},{"style":1370},[2179],{"type":49,"value":1936},{"type":43,"tag":360,"props":2181,"children":2182},{"style":1339},[2183],{"type":49,"value":2184}," AGG_FUNC(column)",{"type":43,"tag":360,"props":2186,"children":2187},{"style":1439},[2188],{"type":49,"value":2189},"      # Must be an aggregate expression\n",{"type":43,"tag":360,"props":2191,"children":2192},{"class":362,"line":480},[2193,2197,2201,2205,2209,2213],{"type":43,"tag":360,"props":2194,"children":2195},{"style":1928},[2196],{"type":49,"value":2100},{"type":43,"tag":360,"props":2198,"children":2199},{"style":1370},[2200],{"type":49,"value":1936},{"type":43,"tag":360,"props":2202,"children":2203},{"style":1370},[2204],{"type":49,"value":1373},{"type":43,"tag":360,"props":2206,"children":2207},{"style":1339},[2208],{"type":49,"value":761},{"type":43,"tag":360,"props":2210,"children":2211},{"style":1370},[2212],{"type":49,"value":1993},{"type":43,"tag":360,"props":2214,"children":2215},{"style":1439},[2216],{"type":49,"value":2121},{"type":43,"tag":360,"props":2218,"children":2219},{"class":362,"line":489},[2220],{"type":43,"tag":360,"props":2221,"children":2222},{"emptyLinePlaceholder":1136},[2223],{"type":49,"value":1139},{"type":43,"tag":360,"props":2225,"children":2226},{"class":362,"line":498},[2227,2232,2236],{"type":43,"tag":360,"props":2228,"children":2229},{"style":1928},[2230],{"type":49,"value":2231},"joins",{"type":43,"tag":360,"props":2233,"children":2234},{"style":1370},[2235],{"type":49,"value":1936},{"type":43,"tag":360,"props":2237,"children":2238},{"style":1439},[2239],{"type":49,"value":2240},"                          # Optional: star\u002Fsnowflake schema\n",{"type":43,"tag":360,"props":2242,"children":2243},{"class":362,"line":507},[2244,2248,2252,2256],{"type":43,"tag":360,"props":2245,"children":2246},{"style":1370},[2247],{"type":49,"value":2051},{"type":43,"tag":360,"props":2249,"children":2250},{"style":1928},[2251],{"type":49,"value":2056},{"type":43,"tag":360,"props":2253,"children":2254},{"style":1370},[2255],{"type":49,"value":1936},{"type":43,"tag":360,"props":2257,"children":2258},{"style":1339},[2259],{"type":49,"value":2260}," dim_table\n",{"type":43,"tag":360,"props":2262,"children":2263},{"class":362,"line":516},[2264,2269,2273],{"type":43,"tag":360,"props":2265,"children":2266},{"style":1928},[2267],{"type":49,"value":2268},"    source",{"type":43,"tag":360,"props":2270,"children":2271},{"style":1370},[2272],{"type":49,"value":1936},{"type":43,"tag":360,"props":2274,"children":2275},{"style":1339},[2276],{"type":49,"value":2277}," catalog.schema.dim_table\n",{"type":43,"tag":360,"props":2279,"children":2280},{"class":362,"line":525},[2281,2287,2291],{"type":43,"tag":360,"props":2282,"children":2284},{"style":2283},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[2285],{"type":49,"value":2286},"    on",{"type":43,"tag":360,"props":2288,"children":2289},{"style":1370},[2290],{"type":49,"value":1936},{"type":43,"tag":360,"props":2292,"children":2293},{"style":1339},[2294],{"type":49,"value":2295}," source.fk = dim_table.pk\n",{"type":43,"tag":360,"props":2297,"children":2298},{"class":362,"line":534},[2299],{"type":43,"tag":360,"props":2300,"children":2301},{"emptyLinePlaceholder":1136},[2302],{"type":49,"value":1139},{"type":43,"tag":360,"props":2304,"children":2305},{"class":362,"line":543},[2306,2310,2314],{"type":43,"tag":360,"props":2307,"children":2308},{"style":1928},[2309],{"type":49,"value":143},{"type":43,"tag":360,"props":2311,"children":2312},{"style":1370},[2313],{"type":49,"value":1936},{"type":43,"tag":360,"props":2315,"children":2316},{"style":1439},[2317],{"type":49,"value":2318},"                # Optional (experimental)\n",{"type":43,"tag":360,"props":2320,"children":2321},{"class":362,"line":552},[2322,2327,2331],{"type":43,"tag":360,"props":2323,"children":2324},{"style":1928},[2325],{"type":49,"value":2326},"  schedule",{"type":43,"tag":360,"props":2328,"children":2329},{"style":1370},[2330],{"type":49,"value":1936},{"type":43,"tag":360,"props":2332,"children":2333},{"style":1339},[2334],{"type":49,"value":2335}," every 6 hours\n",{"type":43,"tag":360,"props":2337,"children":2338},{"class":362,"line":561},[2339,2344,2348],{"type":43,"tag":360,"props":2340,"children":2341},{"style":1928},[2342],{"type":49,"value":2343},"  mode",{"type":43,"tag":360,"props":2345,"children":2346},{"style":1370},[2347],{"type":49,"value":1936},{"type":43,"tag":360,"props":2349,"children":2350},{"style":1339},[2351],{"type":49,"value":2352}," relaxed\n",{"type":43,"tag":58,"props":2354,"children":2356},{"id":2355},"key-concepts",[2357],{"type":49,"value":2358},"Key Concepts",{"type":43,"tag":243,"props":2360,"children":2362},{"id":2361},"dimensions-vs-measures",[2363],{"type":49,"value":2364},"Dimensions vs Measures",{"type":43,"tag":735,"props":2366,"children":2367},{},[2368,2387],{"type":43,"tag":739,"props":2369,"children":2370},{},[2371],{"type":43,"tag":743,"props":2372,"children":2373},{},[2374,2377,2382],{"type":43,"tag":747,"props":2375,"children":2376},{},[],{"type":43,"tag":747,"props":2378,"children":2379},{},[2380],{"type":49,"value":2381},"Dimensions",{"type":43,"tag":747,"props":2383,"children":2384},{},[2385],{"type":49,"value":2386},"Measures",{"type":43,"tag":763,"props":2388,"children":2389},{},[2390,2411,2432,2458],{"type":43,"tag":743,"props":2391,"children":2392},{},[2393,2401,2406],{"type":43,"tag":770,"props":2394,"children":2395},{},[2396],{"type":43,"tag":80,"props":2397,"children":2398},{},[2399],{"type":49,"value":2400},"Purpose",{"type":43,"tag":770,"props":2402,"children":2403},{},[2404],{"type":49,"value":2405},"Categorize and group data",{"type":43,"tag":770,"props":2407,"children":2408},{},[2409],{"type":49,"value":2410},"Aggregate numeric values",{"type":43,"tag":743,"props":2412,"children":2413},{},[2414,2422,2427],{"type":43,"tag":770,"props":2415,"children":2416},{},[2417],{"type":43,"tag":80,"props":2418,"children":2419},{},[2420],{"type":49,"value":2421},"Examples",{"type":43,"tag":770,"props":2423,"children":2424},{},[2425],{"type":49,"value":2426},"Region, Date, Status",{"type":43,"tag":770,"props":2428,"children":2429},{},[2430],{"type":49,"value":2431},"SUM(revenue), COUNT(orders)",{"type":43,"tag":743,"props":2433,"children":2434},{},[2435,2443,2448],{"type":43,"tag":770,"props":2436,"children":2437},{},[2438],{"type":43,"tag":80,"props":2439,"children":2440},{},[2441],{"type":49,"value":2442},"In queries",{"type":43,"tag":770,"props":2444,"children":2445},{},[2446],{"type":49,"value":2447},"Used in SELECT and GROUP BY",{"type":43,"tag":770,"props":2449,"children":2450},{},[2451,2453],{"type":49,"value":2452},"Wrapped in ",{"type":43,"tag":173,"props":2454,"children":2456},{"className":2455},[],[2457],{"type":49,"value":638},{"type":43,"tag":743,"props":2459,"children":2460},{},[2461,2469,2474],{"type":43,"tag":770,"props":2462,"children":2463},{},[2464],{"type":43,"tag":80,"props":2465,"children":2466},{},[2467],{"type":49,"value":2468},"SQL expressions",{"type":43,"tag":770,"props":2470,"children":2471},{},[2472],{"type":49,"value":2473},"Any SQL expression",{"type":43,"tag":770,"props":2475,"children":2476},{},[2477],{"type":49,"value":2478},"Must use aggregate functions",{"type":43,"tag":243,"props":2480,"children":2482},{"id":2481},"why-metric-views-vs-standard-views",[2483],{"type":49,"value":2484},"Why Metric Views vs Standard Views?",{"type":43,"tag":735,"props":2486,"children":2487},{},[2488,2509],{"type":43,"tag":739,"props":2489,"children":2490},{},[2491],{"type":43,"tag":743,"props":2492,"children":2493},{},[2494,2499,2504],{"type":43,"tag":747,"props":2495,"children":2496},{},[2497],{"type":49,"value":2498},"Feature",{"type":43,"tag":747,"props":2500,"children":2501},{},[2502],{"type":49,"value":2503},"Standard Views",{"type":43,"tag":747,"props":2505,"children":2506},{},[2507],{"type":49,"value":2508},"Metric Views",{"type":43,"tag":763,"props":2510,"children":2511},{},[2512,2530,2547,2565,2583],{"type":43,"tag":743,"props":2513,"children":2514},{},[2515,2520,2525],{"type":43,"tag":770,"props":2516,"children":2517},{},[2518],{"type":49,"value":2519},"Aggregation locked at creation",{"type":43,"tag":770,"props":2521,"children":2522},{},[2523],{"type":49,"value":2524},"Yes",{"type":43,"tag":770,"props":2526,"children":2527},{},[2528],{"type":49,"value":2529},"No - flexible at query time",{"type":43,"tag":743,"props":2531,"children":2532},{},[2533,2538,2543],{"type":43,"tag":770,"props":2534,"children":2535},{},[2536],{"type":49,"value":2537},"Safe re-aggregation of ratios",{"type":43,"tag":770,"props":2539,"children":2540},{},[2541],{"type":49,"value":2542},"No",{"type":43,"tag":770,"props":2544,"children":2545},{},[2546],{"type":49,"value":2524},{"type":43,"tag":743,"props":2548,"children":2549},{},[2550,2555,2560],{"type":43,"tag":770,"props":2551,"children":2552},{},[2553],{"type":49,"value":2554},"Star\u002Fsnowflake schema joins",{"type":43,"tag":770,"props":2556,"children":2557},{},[2558],{"type":49,"value":2559},"Manual",{"type":43,"tag":770,"props":2561,"children":2562},{},[2563],{"type":49,"value":2564},"Declarative in YAML",{"type":43,"tag":743,"props":2566,"children":2567},{},[2568,2573,2578],{"type":43,"tag":770,"props":2569,"children":2570},{},[2571],{"type":49,"value":2572},"Materialization",{"type":43,"tag":770,"props":2574,"children":2575},{},[2576],{"type":49,"value":2577},"Separate MV needed",{"type":43,"tag":770,"props":2579,"children":2580},{},[2581],{"type":49,"value":2582},"Built-in",{"type":43,"tag":743,"props":2584,"children":2585},{},[2586,2591,2596],{"type":43,"tag":770,"props":2587,"children":2588},{},[2589],{"type":49,"value":2590},"AI\u002FBI Genie integration",{"type":43,"tag":770,"props":2592,"children":2593},{},[2594],{"type":49,"value":2595},"Limited",{"type":43,"tag":770,"props":2597,"children":2598},{},[2599],{"type":49,"value":2600},"Native",{"type":43,"tag":58,"props":2602,"children":2604},{"id":2603},"common-issues",[2605],{"type":49,"value":2606},"Common Issues",{"type":43,"tag":735,"props":2608,"children":2609},{},[2610,2626],{"type":43,"tag":739,"props":2611,"children":2612},{},[2613],{"type":43,"tag":743,"props":2614,"children":2615},{},[2616,2621],{"type":43,"tag":747,"props":2617,"children":2618},{},[2619],{"type":49,"value":2620},"Issue",{"type":43,"tag":747,"props":2622,"children":2623},{},[2624],{"type":49,"value":2625},"Solution",{"type":43,"tag":763,"props":2627,"children":2628},{},[2629,2645,2661,2677,2701,2736],{"type":43,"tag":743,"props":2630,"children":2631},{},[2632,2640],{"type":43,"tag":770,"props":2633,"children":2634},{},[2635],{"type":43,"tag":80,"props":2636,"children":2637},{},[2638],{"type":49,"value":2639},"SELECT * not supported",{"type":43,"tag":770,"props":2641,"children":2642},{},[2643],{"type":49,"value":2644},"Must explicitly list dimensions and use MEASURE() for measures",{"type":43,"tag":743,"props":2646,"children":2647},{},[2648,2656],{"type":43,"tag":770,"props":2649,"children":2650},{},[2651],{"type":43,"tag":80,"props":2652,"children":2653},{},[2654],{"type":49,"value":2655},"\"Cannot resolve column\"",{"type":43,"tag":770,"props":2657,"children":2658},{},[2659],{"type":49,"value":2660},"Dimension\u002Fmeasure names with spaces need backtick quoting",{"type":43,"tag":743,"props":2662,"children":2663},{},[2664,2672],{"type":43,"tag":770,"props":2665,"children":2666},{},[2667],{"type":43,"tag":80,"props":2668,"children":2669},{},[2670],{"type":49,"value":2671},"JOIN at query time fails",{"type":43,"tag":770,"props":2673,"children":2674},{},[2675],{"type":49,"value":2676},"Joins must be in the YAML definition, not in the SELECT query",{"type":43,"tag":743,"props":2678,"children":2679},{},[2680,2688],{"type":43,"tag":770,"props":2681,"children":2682},{},[2683],{"type":43,"tag":80,"props":2684,"children":2685},{},[2686],{"type":49,"value":2687},"MEASURE() required",{"type":43,"tag":770,"props":2689,"children":2690},{},[2691,2693,2699],{"type":49,"value":2692},"All measure references must be wrapped: ",{"type":43,"tag":173,"props":2694,"children":2696},{"className":2695},[],[2697],{"type":49,"value":2698},"MEASURE(\\",{"type":49,"value":2700},"name`)`",{"type":43,"tag":743,"props":2702,"children":2703},{},[2704,2712],{"type":43,"tag":770,"props":2705,"children":2706},{},[2707],{"type":43,"tag":80,"props":2708,"children":2709},{},[2710],{"type":49,"value":2711},"DBR version error",{"type":43,"tag":770,"props":2713,"children":2714},{},[2715,2717,2722,2723,2728,2729,2734],{"type":49,"value":2716},"Requires Runtime 17.2+ for YAML v1.1, or 16.4+ for v0.1. Semantic metadata (",{"type":43,"tag":173,"props":2718,"children":2720},{"className":2719},[],[2721],{"type":49,"value":178},{"type":49,"value":1235},{"type":43,"tag":173,"props":2724,"children":2726},{"className":2725},[],[2727],{"type":49,"value":186},{"type":49,"value":1235},{"type":43,"tag":173,"props":2730,"children":2732},{"className":2731},[],[2733],{"type":49,"value":193},{"type":49,"value":2735},") needs 17.3+",{"type":43,"tag":743,"props":2737,"children":2738},{},[2739,2747],{"type":43,"tag":770,"props":2740,"children":2741},{},[2742],{"type":43,"tag":80,"props":2743,"children":2744},{},[2745],{"type":49,"value":2746},"Materialization not working",{"type":43,"tag":770,"props":2748,"children":2749},{},[2750],{"type":49,"value":2751},"Requires serverless compute enabled; currently experimental",{"type":43,"tag":58,"props":2753,"children":2755},{"id":2754},"integrations",[2756],{"type":49,"value":2757},"Integrations",{"type":43,"tag":52,"props":2759,"children":2760},{},[2761],{"type":49,"value":2762},"Metric views work natively with:",{"type":43,"tag":70,"props":2764,"children":2765},{},[2766,2776,2786,2796,2806],{"type":43,"tag":74,"props":2767,"children":2768},{},[2769,2774],{"type":43,"tag":80,"props":2770,"children":2771},{},[2772],{"type":49,"value":2773},"AI\u002FBI Dashboards",{"type":49,"value":2775}," - Use as datasets for visualizations",{"type":43,"tag":74,"props":2777,"children":2778},{},[2779,2784],{"type":43,"tag":80,"props":2780,"children":2781},{},[2782],{"type":49,"value":2783},"AI\u002FBI Genie",{"type":49,"value":2785}," - Natural language querying of metrics",{"type":43,"tag":74,"props":2787,"children":2788},{},[2789,2794],{"type":43,"tag":80,"props":2790,"children":2791},{},[2792],{"type":49,"value":2793},"Alerts",{"type":49,"value":2795}," - Set threshold-based alerts on measures",{"type":43,"tag":74,"props":2797,"children":2798},{},[2799,2804],{"type":43,"tag":80,"props":2800,"children":2801},{},[2802],{"type":49,"value":2803},"SQL Editor",{"type":49,"value":2805}," - Direct SQL querying with MEASURE()",{"type":43,"tag":74,"props":2807,"children":2808},{},[2809,2814],{"type":43,"tag":80,"props":2810,"children":2811},{},[2812],{"type":49,"value":2813},"Catalog Explorer UI",{"type":49,"value":2815}," - Visual creation and browsing",{"type":43,"tag":58,"props":2817,"children":2819},{"id":2818},"resources",[2820],{"type":49,"value":2821},"Resources",{"type":43,"tag":70,"props":2823,"children":2824},{},[2825,2836,2846,2856,2868,2877],{"type":43,"tag":74,"props":2826,"children":2827},{},[2828],{"type":43,"tag":334,"props":2829,"children":2833},{"href":2830,"rel":2831},"https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002F",[2832],"nofollow",[2834],{"type":49,"value":2835},"Metric Views Documentation",{"type":43,"tag":74,"props":2837,"children":2838},{},[2839],{"type":43,"tag":334,"props":2840,"children":2843},{"href":2841,"rel":2842},"https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fdata-modeling\u002Fsyntax",[2832],[2844],{"type":49,"value":2845},"YAML Syntax Reference",{"type":43,"tag":74,"props":2847,"children":2848},{},[2849],{"type":43,"tag":334,"props":2850,"children":2853},{"href":2851,"rel":2852},"https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fdata-modeling\u002Fjoins",[2832],[2854],{"type":49,"value":2855},"Joins",{"type":43,"tag":74,"props":2857,"children":2858},{},[2859,2866],{"type":43,"tag":334,"props":2860,"children":2863},{"href":2861,"rel":2862},"https:\u002F\u002Fdocs.databricks.com\u002Fmetric-views\u002Fdata-modeling\u002Fwindow-measures",[2832],[2864],{"type":49,"value":2865},"Window Measures",{"type":49,"value":2867}," (Experimental)",{"type":43,"tag":74,"props":2869,"children":2870},{},[2871],{"type":43,"tag":334,"props":2872,"children":2875},{"href":2873,"rel":2874},"https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fmetric-views\u002Fmaterialization",[2832],[2876],{"type":49,"value":2572},{"type":43,"tag":74,"props":2878,"children":2879},{},[2880],{"type":43,"tag":334,"props":2881,"children":2884},{"href":2882,"rel":2883},"https:\u002F\u002Fdocs.databricks.com\u002Fen\u002Fsql\u002Flanguage-manual\u002Ffunctions\u002Fmeasure",[2832],[2885],{"type":49,"value":2886},"MEASURE() Function",{"type":43,"tag":2888,"props":2889,"children":2890},"style",{},[2891],{"type":49,"value":2892},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2894,"total":3012},[2895,2912,2926,2943,2958,2978,2989],{"slug":2896,"name":2896,"fn":2897,"description":2898,"org":2899,"tags":2900,"stars":23,"repoUrl":24,"updatedAt":2911},"databricks-agent-bricks","create Databricks Agent Bricks","Create Agent Bricks: Knowledge Assistants (KA) for document Q&A and Supervisor Agents for multi-agent orchestration (MAS).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2901,2904,2905,2908],{"name":2902,"slug":2903,"type":15},"Agents","agents",{"name":9,"slug":8,"type":15},{"name":2906,"slug":2907,"type":15},"Knowledge Management","knowledge-management",{"name":2909,"slug":2910,"type":15},"Multi-Agent","multi-agent","2026-07-15T05:41:38.548954",{"slug":2913,"name":2913,"fn":2914,"description":2915,"org":2916,"tags":2917,"stars":23,"repoUrl":24,"updatedAt":2925},"databricks-ai-functions","use Databricks built-in AI functions","Use Databricks built-in AI Functions (ai_classify, ai_extract, ai_summarize, ai_mask, ai_translate, ai_fix_grammar, ai_gen, ai_analyze_sentiment, ai_similarity, ai_parse_document, ai_prep_search, ai_query, ai_forecast) to add AI capabilities directly to SQL and PySpark pipelines without managing model endpoints. Also covers document parsing and building custom RAG pipelines (parse → prep_search → index → query).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2918,2921,2922],{"name":2919,"slug":2920,"type":15},"Data Analysis","data-analysis",{"name":9,"slug":8,"type":15},{"name":2923,"slug":2924,"type":15},"LLM","llm","2026-07-31T05:53:33.562077",{"slug":2927,"name":2927,"fn":2928,"description":2929,"org":2930,"tags":2931,"stars":23,"repoUrl":24,"updatedAt":2942},"databricks-ai-runtime","submit and manage Databricks GPU workloads","Databricks AI Runtime (`air`) CLI — the command-line tool for submitting and managing GPU training workloads on Databricks serverless compute. Use for: running `air` workloads, custom Docker image setup, environment configuration, and troubleshooting `air` jobs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2932,2935,2936,2939],{"name":2933,"slug":2934,"type":15},"CLI","cli",{"name":9,"slug":8,"type":15},{"name":2937,"slug":2938,"type":15},"Docker","docker",{"name":2940,"slug":2941,"type":15},"Engineering","engineering","2026-07-12T08:04:55.843982",{"slug":2944,"name":2944,"fn":2945,"description":2946,"org":2947,"tags":2948,"stars":23,"repoUrl":24,"updatedAt":2957},"databricks-aibi-dashboards","create Databricks AI\u002FBI dashboards","Create Databricks AI\u002FBI dashboards. Must use when creating, updating, or deploying Lakeview dashboards as Databricks Dashboard have a unique json structure. CRITICAL: You MUST test ALL SQL queries via CLI BEFORE deploying. Follow guidelines strictly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2949,2950,2953,2956],{"name":21,"slug":22,"type":15},{"name":2951,"slug":2952,"type":15},"Dashboards","dashboards",{"name":2954,"slug":2955,"type":15},"Data Visualization","data-visualization",{"name":9,"slug":8,"type":15},"2026-07-12T08:04:25.314591",{"slug":2959,"name":2959,"fn":2960,"description":2961,"org":2962,"tags":2963,"stars":23,"repoUrl":24,"updatedAt":2977},"databricks-app-design","design UX for Databricks AppKit applications","Design the UX of custom-code Databricks Apps (AppKit\u002FReact) data screens — KPI\u002Foverview pages, reports, charts, tables, and Genie\u002Fchat data assistants — mapped to concrete AppKit components. Use when BUILDING or reviewing the UI of an AppKit\u002FReact app that displays data or answers data questions: choosing genre, layout, charts, KPIs, semantic color, required states (loading\u002Fempty\u002Ferror), IBCS notation, and AI-result trust (showing generated SQL\u002Fsources for Genie\u002Fchat). A plain \"create a dashboard\" request means a managed AI\u002FBI (Lakeview) dashboard → use databricks-aibi-dashboards, NOT this skill. Also NOT for non-data frontend (forms, settings, auth, marketing) or scaffolding\u002Fbuild\u002Fdeploy (→ databricks-apps). Complements databricks-apps; use it alongside whenever a custom app has a chart, table, KPI, report, or Genie\u002Fchat\u002FAI surface.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2964,2965,2968,2971,2974],{"name":9,"slug":8,"type":15},{"name":2966,"slug":2967,"type":15},"Design","design",{"name":2969,"slug":2970,"type":15},"Frontend","frontend",{"name":2972,"slug":2973,"type":15},"React","react",{"name":2975,"slug":2976,"type":15},"UI Components","ui-components","2026-07-12T08:04:02.02398",{"slug":2979,"name":2979,"fn":2980,"description":2981,"org":2982,"tags":2983,"stars":23,"repoUrl":24,"updatedAt":2988},"databricks-apps","build applications on Databricks Apps","Build apps on Databricks Apps platform. Use when asked to create data apps, analytics tools, or custom interactive visualizations. A plain \"create a dashboard\" request means a managed AI\u002FBI (Lakeview) dashboard → use databricks-aibi-dashboards, not this skill. Evaluates data access patterns (analytics vs Lakebase synced tables) before scaffolding. Invoke BEFORE starting implementation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2984,2985,2986,2987],{"name":21,"slug":22,"type":15},{"name":2951,"slug":2952,"type":15},{"name":2919,"slug":2920,"type":15},{"name":9,"slug":8,"type":15},"2026-07-12T08:03:59.061458",{"slug":2990,"name":2990,"fn":2991,"description":2992,"org":2993,"tags":2994,"stars":23,"repoUrl":24,"updatedAt":3011},"databricks-apps-python","build Python backends for Databricks Apps","Python backend for Databricks Apps — FastAPI (default), Flask, Dash, Streamlit, Gradio, Reflex. **Default for a new Databricks App is `databricks-apps` (AppKit — Node\u002FTypeScript\u002FReact) — reach for it first.** Use this skill only when the user asks for a Python backend, extends an existing Python app, or the team is Python-only. Covers OAuth auth, app resources, SQL warehouse and Lakebase connectivity, foundation-model \u002F Vector Search \u002F model-serving APIs (via `databricks-python-sdk`), and deployment via CLI or DABs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2995,2996,2999,3002,3005,3008],{"name":9,"slug":8,"type":15},{"name":2997,"slug":2998,"type":15},"FastAPI","fastapi",{"name":3000,"slug":3001,"type":15},"Flask","flask",{"name":3003,"slug":3004,"type":15},"Gradio","gradio",{"name":3006,"slug":3007,"type":15},"Python","python",{"name":3009,"slug":3010,"type":15},"Streamlit","streamlit","2026-07-12T08:04:10.970845",31,{"items":3014,"total":3012},[3015,3022,3028,3035,3042,3050,3057,3066,3077,3094,3106,3119],{"slug":2896,"name":2896,"fn":2897,"description":2898,"org":3016,"tags":3017,"stars":23,"repoUrl":24,"updatedAt":2911},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3018,3019,3020,3021],{"name":2902,"slug":2903,"type":15},{"name":9,"slug":8,"type":15},{"name":2906,"slug":2907,"type":15},{"name":2909,"slug":2910,"type":15},{"slug":2913,"name":2913,"fn":2914,"description":2915,"org":3023,"tags":3024,"stars":23,"repoUrl":24,"updatedAt":2925},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3025,3026,3027],{"name":2919,"slug":2920,"type":15},{"name":9,"slug":8,"type":15},{"name":2923,"slug":2924,"type":15},{"slug":2927,"name":2927,"fn":2928,"description":2929,"org":3029,"tags":3030,"stars":23,"repoUrl":24,"updatedAt":2942},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3031,3032,3033,3034],{"name":2933,"slug":2934,"type":15},{"name":9,"slug":8,"type":15},{"name":2937,"slug":2938,"type":15},{"name":2940,"slug":2941,"type":15},{"slug":2944,"name":2944,"fn":2945,"description":2946,"org":3036,"tags":3037,"stars":23,"repoUrl":24,"updatedAt":2957},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3038,3039,3040,3041],{"name":21,"slug":22,"type":15},{"name":2951,"slug":2952,"type":15},{"name":2954,"slug":2955,"type":15},{"name":9,"slug":8,"type":15},{"slug":2959,"name":2959,"fn":2960,"description":2961,"org":3043,"tags":3044,"stars":23,"repoUrl":24,"updatedAt":2977},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3045,3046,3047,3048,3049],{"name":9,"slug":8,"type":15},{"name":2966,"slug":2967,"type":15},{"name":2969,"slug":2970,"type":15},{"name":2972,"slug":2973,"type":15},{"name":2975,"slug":2976,"type":15},{"slug":2979,"name":2979,"fn":2980,"description":2981,"org":3051,"tags":3052,"stars":23,"repoUrl":24,"updatedAt":2988},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3053,3054,3055,3056],{"name":21,"slug":22,"type":15},{"name":2951,"slug":2952,"type":15},{"name":2919,"slug":2920,"type":15},{"name":9,"slug":8,"type":15},{"slug":2990,"name":2990,"fn":2991,"description":2992,"org":3058,"tags":3059,"stars":23,"repoUrl":24,"updatedAt":3011},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3060,3061,3062,3063,3064,3065],{"name":9,"slug":8,"type":15},{"name":2997,"slug":2998,"type":15},{"name":3000,"slug":3001,"type":15},{"name":3003,"slug":3004,"type":15},{"name":3006,"slug":3007,"type":15},{"name":3009,"slug":3010,"type":15},{"slug":38,"name":38,"fn":3067,"description":3068,"org":3069,"tags":3070,"stars":23,"repoUrl":24,"updatedAt":3076},"configure Databricks CLI and authentication","Databricks CLI operations and the parent\u002Fentry-point skill for Databricks CLI use: authentication, profile selection, and bundles. Load this first for CLI, auth, profile, and bundle tasks, then load the matching product skill. For finding or exploring data, answering questions about the data, or generating SQL, load the databricks-data-discovery skill (it routes to Genie One). Contains up-to-date guidelines for Databricks-related CLI tasks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3071,3074,3075],{"name":3072,"slug":3073,"type":15},"Authentication","authentication",{"name":2933,"slug":2934,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:11:05.45506",{"slug":3078,"name":3078,"fn":3079,"description":3080,"org":3081,"tags":3082,"stars":23,"repoUrl":24,"updatedAt":3093},"databricks-dabs","manage Databricks Declarative Automation Bundles","Create, configure, validate, deploy, run, and manage Declarative Automation Bundles (DABs, formerly Databricks Asset Bundles). Use when working with Databricks resources via DABs including dashboards, jobs, pipelines, alerts, volumes, and apps.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3083,3086,3089,3090],{"name":3084,"slug":3085,"type":15},"Automation","automation",{"name":3087,"slug":3088,"type":15},"Configuration","configuration",{"name":9,"slug":8,"type":15},{"name":3091,"slug":3092,"type":15},"Deployment","deployment","2026-07-15T05:41:35.930355",{"slug":3095,"name":3095,"fn":3096,"description":3097,"org":3098,"tags":3099,"stars":23,"repoUrl":24,"updatedAt":3105},"databricks-data-discovery","discover and query Databricks data","Discover, explore, and query Databricks data via Genie — the CLI equivalent of the Genie One MCP. MUST be invoked whenever the user asks to find or locate data ('what tables are in X', 'where does X live', 'which catalog\u002Fschema has Y'), answer a natural-language question about the data, or write a SQL query.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3100,3101,3102,3103],{"name":2919,"slug":2920,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":3104,"slug":353,"type":15},"SQL","2026-07-31T05:53:32.561877",{"slug":3107,"name":3107,"fn":3108,"description":3109,"org":3110,"tags":3111,"stars":23,"repoUrl":24,"updatedAt":3118},"databricks-dbsql","query and script Databricks SQL warehouses","Databricks SQL (DBSQL) advanced features and SQL warehouse capabilities. This skill MUST be invoked when the user mentions: \"DBSQL\", \"Databricks SQL\", \"SQL warehouse\", \"SQL scripting\", \"stored procedure\", \"CALL procedure\", \"materialized view\", \"CREATE MATERIALIZED VIEW\", \"pipe syntax\", \"|>\", \"geospatial\", \"H3\", \"ST_\", \"spatial SQL\", \"collation\", \"COLLATE\", \"ai_query\", \"ai_classify\", \"ai_extract\", \"ai_gen\", \"AI function\", \"http_request\", \"remote_query\", \"read_files\", \"Lakehouse Federation\", \"recursive CTE\", \"WITH RECURSIVE\", \"multi-statement transaction\", \"temp table\", \"temporary view\", \"pipe operator\". SHOULD also invoke when the user asks about SQL best practices, data modeling patterns, or advanced SQL features on Databricks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3112,3113,3116,3117],{"name":2919,"slug":2920,"type":15},{"name":3114,"slug":3115,"type":15},"Database","database",{"name":9,"slug":8,"type":15},{"name":3104,"slug":353,"type":15},"2026-07-12T08:04:08.678282",{"slug":3120,"name":3120,"fn":3121,"description":3122,"org":3123,"tags":3124,"stars":23,"repoUrl":24,"updatedAt":3132},"databricks-docs","search Databricks documentation","Databricks documentation reference via llms.txt index. Use when other skills do not cover a topic, looking up unfamiliar Databricks features, or needing authoritative docs on APIs, configurations, or platform capabilities.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3125,3126,3129],{"name":9,"slug":8,"type":15},{"name":3127,"slug":3128,"type":15},"Documentation","documentation",{"name":3130,"slug":3131,"type":15},"Reference","reference","2026-07-15T05:41:34.697746"]