Define a Databricks Unity Catalog metric view using CREATE OR REPLACE VIEW WITH METRICS LANGUAGE YAML to centralize business metric definitions

domain: docs.databricks.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Ensure your cluster runs Databricks Runtime 17.3 or higher (or a SQL warehouse on the 2025.30 channel Preview) and that Unity Catalog is enabled on your workspace
  2. Write a CREATE OR REPLACE VIEW catalog.schema.view_name WITH METRICS LANGUAGE YAML AS $$ statement followed by the YAML body specifying version: 1.1, source (a Unity Catalog table or query), fields, and measures
  3. Under measures, define each metric as an aggregate expression using standard SQL aggregate functions (e.g., SUM(revenue), COUNT(DISTINCT user_id)) with a name and optional description
  4. Under fields, declare the columns available for GROUP BY and WHERE filtering at query time, referencing columns from the source table
  5. Query the metric view using SELECT with GROUP BY to retrieve aggregated results, leveraging Unity Catalog lineage and governance features automatically applied to the view

Known gotchas

Related routes

Understand and create managed vs external volumes in Unity Catalog
docs.databricks.com · 5 steps · unrated
Govern models with Unity Catalog registered models
databricks.com · 6 steps · unrated
Register external lineage metadata in Unity Catalog for pipelines and BI tools that run outside Databricks
docs.databricks.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans