06-reference

rill metrics sql semantic layer agents

Tue Apr 07 2026 20:00:00 GMT-0400 (Eastern Daylight Time) ·reference ·source: Rill Data Blog ·by Nishant Bangarwa (Rill Data)

Rill Metrics SQL — A Semantic Layer for Humans and Agents

Why this is in the vault

Rill’s Metrics SQL is a product implementation of the thesis Natkins articulated and the dbt benchmark validated: the data layer, not the model, determines answer quality. The MCP integration makes this directly relevant to the DuckDB evaluation on the board — Rill demonstrates how agents can query governed metrics without raw warehouse access.

The product

Metrics SQL is a SQL dialect where you query metric names instead of writing raw aggregation logic. You write SELECT total_revenue FROM metrics WHERE region = 'APAC' and the system deterministically compiles that into the correct native OLAP SQL — applying the canonical definition of total_revenue including all filters, joins, and business logic.

The architecture: metrics views define measures (aggregations), dimensions (group-by attributes), and metadata. A parser interprets Metrics SQL queries, a compiler resolves metric definitions against the underlying schema, and an executor runs the compiled native SQL against the OLAP engine. The metric definition lives in one place and is enforced everywhere.

The agent integration

Rill ships an MCP server that lets Claude query governed metrics directly. The agent never touches raw tables — it accesses the semantic layer, which guarantees that every number matches the canonical definition. This solves what Bangarwa frames as the persistent problem in analytics: when finance says your number does not match theirs, someone used a different definition. A single authoritative source eliminates the discrepancy by construction.

Beyond MCP, Rill includes a built-in chat interface (Rill Chat) and a Claude integration, positioning metrics as first-class database keywords — what they call “zero-hop metrics queries” where the distance between asking and getting the governed answer is zero.

Mapping against Ray Data Co

This implements Natkins’s “data layer does the work” thesis as a shipping product. The MCP integration is the key differentiator for RDCO’s evaluation: agents access governed data, not raw tables, which means the agent inherits the data layer’s correctness guarantees without needing its own validation logic.

Relevant to the DuckDB evaluation — Rill’s agentic query pattern (many small metric lookups via MCP) is exactly the access pattern Natkins described. Strong Sanity Check candidate: the dbt benchmark proves semantic layers win on accuracy, and Rill shows what the product implementation looks like.