Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Metric views are registered to Unity Catalog and can be managed using Catalog Explorer. Users with at least SELECT permission can view metric view details, and owners can control access, enable collaborative editing, and manage the lifecycle of metric views through the UI or SQL commands.
View metric views in Catalog Explorer
Catalog Explorer provides an interface for viewing and managing metric views.
To access a metric view in Catalog Explorer:
- Click
Catalog in the sidebar.
- Browse available data or use the search bar to search for the metric view by name.
- Click the name of the metric view.
Catalog Explorer displays information across multiple tabs. Use each tab to view or edit details for the metric view.
Set permissions
Metric views use the same hierarchical permissions model as other Unity Catalog securable objects. No new permissions are necessary if your metric view is stored in a schema that the intended consumers have read access to. You can assign permissions on the metric view from the Permissions tab or using SQL.
Grant privileges using SQL
A metric view is a Unity Catalog securable object and follows the same permission model as other views. Privileges are hierarchical, so privileges on a metastore, catalog, or schema cascade to the objects they contain. The following example grants minimum privileges for users in the data_consumers group to query a metric view:
GRANT SELECT ON orders_metric_view to `data-consumers`;
To learn more about privileges in Unity Catalog, see Manage privileges in Unity Catalog. To learn more about creating and managing groups, see Groups.
Grant permissions using the UI
You can also grant privileges using Catalog Explorer:
- Find the metric view in Catalog Explorer.
- Click Permissions.
- Use the UI to grant and revoke permissions for other Azure Databricks users and groups.
For more details, see Grant permissions on an object.
Edit a metric view
You must be the owner of a metric view to edit its definition. To enable collaborative editing, transfer ownership to a group. See Enable collaborative editing.
To edit a metric view in Catalog Explorer:
- Find the metric view in Catalog Explorer.
- Click Edit to open the editor.
- Use the UI tab to change fields and measures interactively, or click the
<>button to edit the YAML definition directly. - Click Save.
Any user with at least SELECT privileges can query the metric view. To learn more about managing permissions, see Set permissions.
Edit with SQL
To edit a metric view with SQL, use ALTER VIEW with an updated YAML definition. ALTER VIEW replaces the full definition, so include the complete YAML, not only the parts you change:
ALTER VIEW catalog.schema.orders_metric_view
AS $$
<complete YAML definition>
$$
Enable collaborative editing
Only the owner of a metric view can edit its definition. To enable multiple people to collaborate on the same metric view, transfer ownership to a group. All members of that group can then edit the definition. The metric view can only access data that the group has permissions to select.
To enable collaborative editing:
- Create or identify a group that should have edit access to the metric view. See Groups.
- Grant the group
SELECTaccess to all tables the metric view depends on. - Transfer ownership of the metric view to the group. See Manage object ownership.
- Add or remove users from the group to control who can edit the metric view.
Note
Transferring ownership to a group is not supported for materialized metric views. Collaborative editing is only available for non-materialized metric views.
Drop a metric view
Use DROP VIEW syntax to delete a metric view:
DROP VIEW orders_metric_view;
Warning
Dropping a metric view is permanent and can't be undone. Verify that no downstream consumers (dashboards, notebooks, queries) depend on the metric view before dropping it. Use the Lineage tab in Catalog Explorer to identify dependencies.
Limitations
Metric views don't support OpenSharing or data profiling.