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
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
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
Under fields, declare the columns available for GROUP BY and WHERE filtering at query time, referencing columns from the source table
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
Metric views require YAML specification version 1.1 or higher; using version 1.0 disables semantic metadata features and the view will behave as a standard view without metric semantics
The source field in the YAML body must reference a Unity Catalog table-like asset (table, view, materialized view, streaming table, or foreign table); arbitrary external stage references are not supported
Metric views participate in Unity Catalog lineage tracking, which is generally beneficial but means that dropping or renaming the source table will break the metric view and any downstream dashboards referencing it
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp