> ## Documentation Index
> Fetch the complete documentation index at: https://docs.credibledata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from Databricks Metric Views

> Convert your Unity Catalog metric views into governed Malloy semantic models

Databricks metric views define governed measures and dimensions over your Delta tables in Unity Catalog. Credible reads that definition, rebuilds it as Malloy, and — where you connect the workspace — validates each measure with the same `MEASURE()` queries you'd run in Databricks.

## What Credible Reads

Your **Unity Catalog metric views** — YAML definitions with a `source`, `dimensions`, `measures`, `joins`, and an optional top-level `filter`. The agent works from that YAML. Connecting to the workspace is optional but the natural way to fetch and validate it: pull the definition with `DESCRIBE TABLE EXTENDED <catalog.schema.view> AS JSON`, discover views through Unity Catalog's `information_schema`, or read through a Genie / AI-BI space where one is configured (measures are read only through the `MEASURE()` function).

## What Comes Across

The everyday modeling carries over. Here's how the bigger pieces land — and where they get better:

| In Databricks                                     | In Credible                                                                                                                            |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Metric view (source, dimensions, measures, joins) | Malloy **sources**, dimensions, measures, and joins                                                                                    |
| `MEASURE()`-only aggregates                       | Regular measures you query directly and join natively — no `MEASURE()` wrapper or CTE-to-join workaround                               |
| Top-level `filter`                                | Source-level `where:`                                                                                                                  |
| Unity Catalog grants / row filters / masks        | **Fine-grained access control in the model**, versioned and enforced on every surface                                                  |
| Descriptions                                      | `#(doc)` / `#(index)`, indexed by the [Context Engine](/how-to/analyzing/overview)                                                     |
| Genie / AI-BI, dashboards                         | Every surface — agents over MCP, [data apps](/how-to/analyzing/data-apps), [notebooks](/how-to/analyzing/workspaces), dashboards, APIs |

## The Migration Flow

Credible [reads](/how-to/migrating/overview) the metric-view YAML, translates the source, joins, dimensions, and measures to Malloy, enriches with `#(doc)`/`#(index)` tags, and — where the workspace is connected — validates row-by-row with `SELECT <dim>, MEASURE(<measure>) … GROUP BY ALL`.

## What Credible Handles

* **`MEASURE()`-only access** — metric-view measures can't be read as plain columns, so Credible mirrors each aggregate expression, preserving semi-additive behavior instead of blindly re-aggregating.
* **Unity Catalog governance** — grants, row filters, and column masks live in Unity Catalog and do **not** travel with the YAML. Credible re-establishes equivalent controls in its own [access-control layer](/how-to/modeling/fine-grained-acls) rather than pretending they came along.
* **Upstream joins** — because joining a metric view to other tables requires wrapping it in a CTE, those joins are modeled explicitly as Malloy sources and joins.

<Note>
  Databricks metric views are a recent Unity Catalog feature and the YAML spec is still evolving. Credible reads the current `version:` from each definition; confirm the spec version in your workspace when you migrate.
</Note>

## Before & After

A Unity Catalog metric view:

```yaml theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
version: 1.1
source: samples.sales.orders
comment: "Order metrics with customer attributes"
filter: o_orderdate >= '2024-01-01'
joins:
  - name: customer
    source: samples.sales.customer
    on: source.customer_id = customer.customer_id
    cardinality: many_to_one
dimensions:
  - name: Order Status
    expr: order_status
  - name: Order Month
    expr: DATE_TRUNC('MONTH', o_orderdate)
measures:
  - name: Total Revenue
    expr: SUM(amount)
    format: { type: currency }
  - name: Completed Revenue
    expr: SUM(CASE WHEN order_status = 'completed' THEN amount END)
  - name: Avg Order Value
    expr: SUM(amount) / NULLIF(COUNT(1), 0)
```

```malloy theme={"languages":{"custom":["/languages/motly.tmGrammar.json","/languages/malloy.tmGrammar.json"]}}
source: orders is conn.table('samples.sales.orders') extend {
  primary_key: order_id
  join_one: customer is conn.table('samples.sales.customer') on customer_id

  where: o_orderdate >= @2024-01-01

  dimension:
    #(doc) Order status
    #(index)
    status is order_status

    #(doc) Customer segment
    #(index)
    customer_segment is customer.segment

  measure:
    #(doc) Total revenue in USD
    # currency
    total_revenue is sum(amount)

    #(doc) Revenue from completed orders
    # currency
    completed_revenue is sum(amount) { where: status = 'completed' }

    #(doc) Number of orders
    order_count is count()

    #(doc) Average order value
    # currency
    avg_order_value is total_revenue / order_count

  view:
    #(doc) Revenue by month
    revenue_by_month is {
      group_by: o_orderdate.month
      aggregate: total_revenue
    }
}
```

The top-level `filter` becomes a source-level `where:`, aggregate expressions become measures (a `SUM(CASE WHEN …)` becomes a clean `{ where: … }` filter), and `format` maps to render tags. Governance stays behind in Unity Catalog and is re-created in Credible.

**More than a reformat.** The model is AI-usable through the [Context Engine](/how-to/analyzing/overview) and composes into follow-up questions your `MEASURE()`-bound metric views couldn't express. [See what you gain →](/how-to/migrating/overview#more-than-a-reformat)

## Next Steps

<CardGroup cols={2}>
  <Card title="Migration Overview" icon="diagram-project" color="#5C7A93" href="/how-to/migrating/overview">
    The method behind every migration
  </Card>

  <Card title="Access Control" icon="filter" color="#94793A" href="/how-to/modeling/fine-grained-acls">
    Re-establish Unity Catalog governance in Credible
  </Card>
</CardGroup>
