# Best Semantic Layers in 2026: dbt MetricFlow vs Cube vs Snowflake

> The 3 most popular semantic layers (dbt MetricFlow, Cube, Snowflake semantic views), the fourth option (no semantic layer), how to use each with the nao analytics agent, and which one to pick.

Source: https://getnao.io/blog/semantic-layer-ai-agents/
Published: 22 November 2026 by Claire Gouze

The semantic layer is one of the most discussed topics in data right now.

A **semantic layer** stores your business definitions (metrics, dimensions, entities and the joins between them) once, and compiles every request into SQL from them. The three most popular today are **dbt MetricFlow**, **Cube** and **Snowflake semantic views**. All three work with nao, the open source analytics agent: MetricFlow natively, Snowflake semantic views as synced context, Cube through its MCP server.

There is a fourth option most comparisons leave out: **no semantic layer**. A rules file listing each metric and its source table, documented columns and a data model built for agents. In our benchmark, that setup reached 86% correct answers, against 82% for a MetricFlow layer after four rounds of manual work. So this post compares four options, not three: if you want a semantic layer for your agent, pick **MetricFlow**; if you don't have one yet, start without.

## The 3 most popular semantic layers, and the option of none

### dbt MetricFlow

MetricFlow is the SQL generation engine behind the **dbt Semantic Layer**. You define semantic models, entities, dimensions and metrics (simple, ratio, cumulative, derived, conversion) in YAML, in your dbt project, and MetricFlow builds the joins and the SQL, avoiding fan-out and chasm joins. It is open source under Apache 2.0. Starting with dbt v1.12, it can read semantic models written as Ossie documents ([MetricFlow docs](https://docs.getdbt.com/docs/build/about-metricflow)).

The same example in each option below: a `revenue` metric on an orders table. In MetricFlow, with the YAML spec of dbt v1.12 and later (older projects declare `measures` in a `semantic_models:` block):

```yaml
# models/marts/fct_orders.yml
models:
  - name: fct_orders
    semantic_model:
      enabled: true
    agg_time_dimension: ordered_at
    columns:
      - name: order_id
        entity:
          type: primary
          name: order
      - name: customer_id
        entity:
          type: foreign
          name: customer
      - name: ordered_at
        granularity: day
        dimension:
          type: time
      - name: status
        dimension:
          type: categorical
    metrics:
      - name: revenue
        label: Revenue
        type: simple
        agg: sum
        expr: order_total
```

Its strength: your metrics sit next to the models they aggregate, and they are reviewed in the same pull requests. Its catch for agents: the dbt Semantic Layer APIs, and the integrations built on them, require a dbt platform Starter or Enterprise account ([dbt Semantic Layer docs](https://docs.getdbt.com/docs/use-dbt-semantic-layer/dbt-sl)).

### Cube

Cube is a semantic layer (**Cube Core**, open source, Apache 2.0 by default) plus an agentic analytics platform (**Cube Cloud**). You define cubes (measures, dimensions, joins) and views in YAML or JavaScript, in version control, and query them through a Postgres-compatible SQL API, REST, GraphQL or the Meta API. Pre-aggregations in Cube Store and access policies as code are its extra strengths ([Cube docs](https://docs.cube.dev/docs/introduction)).

```yaml
# model/cubes/orders.yml
cubes:
  - name: orders
    sql_table: analytics.fct_orders

    joins:
      - name: customers
        relationship: many_to_one
        sql: "{CUBE.customer_id} = {customers.customer_id}"

    measures:
      - name: revenue
        type: sum
        sql: order_total

    dimensions:
      - name: order_id
        sql: order_id
        type: number
        primary_key: true

      - name: status
        sql: status
        type: string

      - name: ordered_at
        sql: ordered_at
        type: time
```

It shines when many apps or tenants hit the same data. A practitioner on r/PostgreSQL put Cube Core in front of a Postgres replica, with row filters compiled from a signed JWT and rollups in Cube Store, and reported p95 dashboard waits going [from 14 seconds to under 60 ms](https://www.reddit.com/r/PostgreSQL/comments/1y1ilvb/multitenant_dashboards_with_postgres_rls_started/). Their warning: watch dimension cardinality in rollups.

### Snowflake semantic views

Semantic views are schema-level objects in Snowflake that store logical tables, relationships, facts, dimensions and metrics. You create them with `CREATE SEMANTIC VIEW`, a YAML spec, or the Autopilot and Semantic Studio UIs, and query them with `SELECT ... FROM SEMANTIC_VIEW(...)` or `SELECT` with `AGG()` ([Snowflake docs](https://docs.snowflake.com/en/user-guide/views-semantic/overview)). Cortex Analyst and Cortex Agents use them to generate SQL.

```sql
CREATE SEMANTIC VIEW analytics.orders_sv
  TABLES (
    orders AS analytics.fct_orders PRIMARY KEY (order_id),
    customers AS analytics.dim_customers PRIMARY KEY (customer_id)
  )
  RELATIONSHIPS (
    orders_to_customers AS orders (customer_id) REFERENCES customers
  )
  FACTS (
    orders.order_total AS order_total
  )
  DIMENSIONS (
    orders.ordered_at AS ordered_at,
    customers.country AS country
  )
  METRICS (
    orders.revenue AS SUM(orders.order_total)
  )
  COMMENT = 'Revenue by customer country';

-- Query it
SELECT * FROM SEMANTIC_VIEW(
  analytics.orders_sv
  METRICS orders.revenue
  DIMENSIONS customers.country
);
```

No extra infrastructure if you are all-in on Snowflake. The catch: they only work in Snowflake, and your definitions live in Snowflake, not next to your dbt models.

### Option 4: no semantic layer

The agent writes SQL from the context your data team maintains: a rules file with each metric's definition and source-of-truth table, column descriptions, dbt docs, and tables modeled so the right one is obvious. Nothing to compile, no extra infrastructure, and no question falls outside a layer's scope. The catch: definitions live in prose and docs, so they are only as consistent as your tests. That is why this option comes with an evaluation suite. We tested it against MetricFlow in our [semantic layer impact study](/blog/semantic-layer-impact-analytics-agent/), and it came out ahead on accuracy, speed and cost.

The same metric, written in the `RULES.md` the agent reads:

```markdown
# RULES.md

## Metrics
- **Revenue**: `SUM(order_total)` from `analytics.fct_orders`, only `status = 'completed'`.
  Never compute it from `stg_orders`: it includes test orders.
- **Revenue by country**: join `analytics.dim_customers` on `customer_id`, group by `country`.

## Tables
- `analytics.fct_orders`: one row per order, the source of truth for revenue.
- `analytics.dim_customers`: one row per customer.
```

### At a glance

| | dbt MetricFlow | Cube | Snowflake semantic views | No semantic layer |
|---|---|---|---|---|
| **Open source** | Yes, Apache 2.0 | Cube Core, Apache 2.0 by default | No, a Snowflake feature | Nothing to license |
| **Where definitions live** | YAML in your dbt project | YAML or JavaScript, in version control | In Snowflake | A rules file and docs, in your repo |
| **Building blocks** | Semantic models, entities, dimensions, metrics | Cubes (measures, dimensions, joins) and views | Logical tables, relationships, facts, dimensions, metrics | Metric definitions, column descriptions, clean models, tests |
| **Warehouses** | Snowflake, BigQuery, Databricks, Redshift, Postgres | Connects to your warehouse or database | Snowflake only | Any |
| **Best for** | Teams already on dbt | Many apps or tenants on the same data | Teams all-in on Snowflake | Most teams starting an agent, and questions beyond predefined metrics |

We also review Cube as an agent in our [nao vs Cube comparison](/resources/compare/cube/), and Snowflake's agent in our [Snowflake Cortex review](/blog/snowflake-cortex-review/).

## How to use each semantic layer with nao

nao is an open source analytics agent: your data team builds its context (schemas, dbt docs, rules, skills) as files, and business users ask questions in plain English. A semantic layer is one more piece of that context.

### dbt MetricFlow: native

Point `nao_config.yaml` at the `semantic_manifest.json` that `dbt parse` produces:

```yaml
semantic_layer:
  type: metricflow
  manifest_path: ./repos/dbt/target/semantic_manifest.json
  database: snowflake-prod
```

Then run `nao sync`. nao writes one file per metric in `semantics/metrics/` and gives the agent an `execute_semantic_query` tool that takes metrics, dimensions and filters instead of SQL. MetricFlow runs inside nao as a SQL compiler only: no call to dbt Cloud, no Semantic Layer plan, and the compiled SQL goes through the same read-only checks as any other query.

Admins pick a mode under **Settings** -> **Agent** -> **SQL**: **Semantics first** (default, falls back to SQL for what the layer doesn't cover), **Semantics only**, or **Don't use semantics**. Full setup in the [semantic layer docs](https://docs.getnao.io/nao-agent/context-builder/semantic-layer).

### Snowflake semantic views: synced as context

Nothing to configure. When `nao sync` runs against Snowflake, it imports the semantic views in your account (metrics, dimensions, relationships) into a `definition.md` per view, next to the table metadata. The agent reads them as the intended way to query and aggregate the data. See [Snowflake semantic views in the databases docs](https://docs.getnao.io/nao-agent/context-builder/databases#snowflake-semantic-views).

### Cube: through its MCP server

nao has no native Cube integration today. Cube hosts an MCP server for its platform, and nao's agent can call any MCP server you declare in `agent/mcps/mcp.json`, including remote HTTP servers ([MCP docs](https://docs.getnao.io/nao-agent/chat/capabilities/tools-mcps-skills)). Expect the trade-off we measured with the dbt MCP: governed answers, more tool calls, slower answers.

### No semantic layer: rules, docs and tests

This is nao's default. `nao sync` writes your warehouse metadata and dbt docs as files, you describe each metric and its source table in `RULES.md`, and [`nao test`](/blog/analytics-agent-benchmark-context-stack/) checks the agent's answers against the SQL you expect. The method is in our [context engineering guide](/blog/how-to-do-context-engineering-for-data-teams/) and in [4 steps to improve your analytics agent reliability from 45% to 86%](/blog/improve-analytics-agent-reliability-steps/); the data model side in [how to do data modeling for AI agents](/blog/how-to-do-data-modeling-for-ai-agents/).

## Do you really need a semantic layer?

Before you pick one: no, it's not mandatory.

**A semantic layer solves computation, not orientation.** Answering "what was our MRR last month?" takes two steps: finding which metric and which table the question means (MRR? ARR? billing month or subscription month?), then computing it. A semantic layer makes the second step deterministic. The first step, where agents actually fail, is still the agent's job.

**Our numbers**, on our own agent, 40 tests over 12 tables:

| Setup | Correct answers |
|---|---|
| AI-generated MetricFlow semantic layer, as the only way to query | 4% to 13% (most questions fell outside its scope) |
| Same layer after 4 rounds of manual work | 82% |
| No semantic layer: rules file, documented columns, a data model built for agents | **86%** |

The semantic layer version was also slower and more expensive, because every answer went through MCP tool calls. We wrote up each step:

* [What context has the most impact on analytics agent performance?](/blog/context-impact-analytics-agent/): the first study, where the semantic layer was so restrictive the agent answered almost nothing.
* [What is the impact of a semantic layer on analytics agent performance?](/blog/semantic-layer-impact-analytics-agent/): MetricFlow against a plain rules file, on accuracy, speed and cost.
* [How to make the semantic layer work for analytics agents](/blog/how-to-make-semantic-layer-work-for-analytics-agents/): the 4 steps that took the semantic layer agent to 82%.
* [5 steps to deploy an analytics agent on dbt MCP](/blog/deploy-analytics-agent-dbt-mcp-steps/): what the dbt Semantic Layer MCP needs (a Starter license) and where it is harder to go outside the layer.

So:

* **You don't have a semantic layer:** don't start by building one. Test the agent on what you already have (schema, dbt docs, a rules file listing each metric and its source-of-truth table) and fix the data model where tests fail. That's how we went [from 45% to 86%](/blog/improve-analytics-agent-reliability-steps/).
* **You already have one** (MetricFlow, Cube, Snowflake semantic views, LookML, TMDL): use it as context, next to your rules and docs, and let your tests tell you whether querying through it helps.
* **When it starts to pay off:** our hypothesis is that it matters more as the number of tables and the number of teams sharing the same metrics grow.

In the current debate, WisdomAI's CPO called the semantic layer "necessary, but not sufficient" for chat over data ([Chain of Thought](https://dev.to/conorbronsdon/your-data-agent-can-have-perfect-context-and-still-be-wrong-26pf)). We agree with "not sufficient", not with "necessary": picking the right metric is [context engineering](/blog/how-to-do-context-engineering-for-data-teams/) work, with business definitions, rules and a [data model built for agents](/blog/how-to-do-data-modeling-for-ai-agents/).

Whatever you choose, test it: write 20 to 40 metric questions, run them with and without the layer using [nao's evaluation framework](https://docs.getnao.io/nao-agent/context-engineering/evaluation), and keep the layer only if it moves your numbers.

## Summary: the best semantic layer to use with nao

| Semantic layer | How nao uses it | Setup | Our take |
|---|---|---|---|
| **dbt MetricFlow** | Native: compiled inside nao, queried with `execute_semantic_query` | Point `nao_config.yaml` at `semantic_manifest.json` | **Best choice if you want a semantic layer** |
| **Snowflake semantic views** | Synced as context by `nao sync` | Nothing to configure | Use the ones you have, don't build new ones for nao |
| **Cube** | Through Cube's MCP server | Declare it in `agent/mcps/mcp.json` | Works, but slower: not native |
| **No semantic layer** | Default: rules file, docs and dbt context, tested with `nao test` | Write `RULES.md`, run `nao test` | **Best place to start**: 86% in our benchmark |

**If you want a semantic layer with nao, use dbt MetricFlow.** It is open source, lives in your dbt project next to the models it aggregates, needs no dbt Cloud plan with nao, and is the only one nao compiles natively, with a fallback to SQL for what it doesn't cover. If you don't have one yet, start without: rules, a clean data model and tests got us to 86%.

nao is open source: [github.com/getnao/nao](https://github.com/getnao/nao) · [docs](https://docs.getnao.io/nao-agent/quickstart)

## FAQ

**What are the most popular semantic layers?**
dbt MetricFlow (the engine behind the dbt Semantic Layer), Cube (Cube Core and Cube Cloud) and Snowflake semantic views. Apache Ossie, formerly OSI, is an emerging open specification for exchanging semantic models between them.

**What is the best semantic layer for an AI agent?**
With nao, dbt MetricFlow: nao compiles it natively, with no dbt Cloud plan, and falls back to SQL for questions the layer doesn't cover. Snowflake semantic views are synced as context, Cube works through its MCP server.

**Does an AI agent need a semantic layer?**
No, it's not mandatory. A semantic layer tells the agent how to compute a metric, not which metric a question is about. In our benchmark on 12 tables, a well-written rules file and a clean data model reached 86% reliability without one, versus 82% with a MetricFlow layer after extensive manual work.

**What is a semantic layer?**
A semantic layer stores business definitions (metrics, dimensions, entities and how tables join) in one place and compiles requests into SQL from them. Every tool that queries through it, from a dashboard to an AI agent, gets the same number for the same metric.

**Do I need dbt Cloud to use MetricFlow with an AI agent?**
The dbt Semantic Layer APIs and its integrations require a dbt platform Starter or Enterprise account. nao does not: it compiles queries with MetricFlow locally from the `semantic_manifest.json` that `dbt parse` produces, and runs them on your warehouse.

**What are Snowflake semantic views?**
Schema-level Snowflake objects that define logical tables, relationships, facts, dimensions and metrics. You query them with a `SEMANTIC_VIEW` clause or with `SELECT` and `AGG()`, and Cortex Agents and Cortex Analyst use them to generate SQL.

**Is Cube open source?**
Yes. Cube Core is open source, under the Apache 2.0 license by default. Cube Cloud adds the hosted platform, Analytics Chat and the hosted MCP server.
