← Back to Writing
2026-11-12 • 4 min read

Why NL-to-SQL Fails Without a Semantic Layer (and How to Govern It)

AI-for-BISemantic LayerGovernanceH·AI·BI

Most natural-language-to-SQL demos look magical on a 3-table toy database, then fall apart the moment they hit a real enterprise warehouse.

When a business user asks “What was net margin by region last quarter?”, raw schema prompting runs into three immediate failure modes:

  1. Ambiguous business definitions: Three tables have columns named amount, revenue, or net_rev. Without an explicit semantic layer defining the canonical metric formula, the LLM guesses.
  2. Silent permission leaks: A generic SQL generator doesn’t know which rows or fields a given user role is allowed to see unless Row-Level Security (RLS) and field sensitivity rules are enforced centrally, outside the prompt.
  3. Unverifiable answers: Executives don’t trust a chart if they cannot trace the exact SQL, tables, and filters behind it.

The Architecture Pattern That Holds Up

In H·AI·BI™, natural-language analytics is structured as a governed pipeline rather than a raw prompt wrapper:

  • Semantic & Metric Layer first: Business entities, joins, and metric definitions live in a versioned semantic model with a DEV → QA → PROD promotion path.
  • Schema-aware guardrails: Generated queries are validated against allowed tables, columns, and read-only constraints before execution.
  • Centralized Governance: RLS and field sensitivity policies apply uniformly to both Ask and Deep Dive queries.
  • Evidence-linked Deep Dive ([E#]): Multi-step analytical answers cite their underlying query outputs so analysts and leaders can audit every number.

AI-for-BI only earns adoption when the governance model is stronger than the prompt.