Not a Template Engine

OnlyMetrix doesn't template SQL. It compiles business logic into an Intermediate Representation.

Every metric goes through the compiler

Before a single row is queried, OnlyMetrix decomposes, validates, and classifies your business logic.

IR Decomposition

Decomposes SQL into structured IR: measures, dimensions, joins, filters. Every component named, typed, and auditable.

Fan-Out Detection

Detects fan-out risk before queries run. If a join would multiply rows, you know at compile time, not after a $400 Snowflake bill.

PII Validation

Validates PII exposure at compile time. Columns tagged as sensitive are masked before any agent sees a single value.

Structural Diffing

Structural diffing between metric versions. See exactly what changed in the IR, not a line-by-line SQL diff, but a semantic one.

Three-Way Classification

Every metric is classified: Structured (fully decomposed IR), Opaque-Upgradeable (SQL that could be decomposed), or Opaque-Intentional (complex SQL that should stay as-is). Not every metric needs to be structured, and the compiler knows the difference.

From SQL to Intermediate Representation

The compiler takes your SQL and produces a structured IR. Every component is named, typed, and independently testable.

input: SQL metric
SELECT
  date_trunc('month', order_date) AS month,
  SUM(amount) AS total_revenue,
  COUNT(DISTINCT customer_id) AS customers
FROM orders
WHERE status = 'completed'
  AND order_date >= '2024-01-01'
GROUP BY 1
output: Compiled IR
{
  "classification": "Structured",
  "measures": [
    { "name": "total_revenue", "expr": "SUM(amount)" },
    { "name": "customers", "expr": "COUNT(DISTINCT customer_id)" }
  ],
  "dimensions": [
    { "name": "month", "expr": "date_trunc('month', order_date)" }
  ],
  "filters": [
    { "column": "status", "op": "=", "value": "completed" },
    { "column": "order_date", "op": ">=", "value": "2024-01-01" }
  ],
  "source_table": "orders",
  "fan_out_risk": false,
  "pii_columns": []
}
622 679 tests. Zero regressions.

The compiler ships with comprehensive test coverage. Every decomposition, every classification, every edge case, tested. When we add features, nothing breaks.

Stop templating. Start compiling.

Your metrics deserve the same rigor as your application code.