0sql — semantic specs in, complex SQL out

· 0sql

7 min read Original article ↗

semantic layer as a service

Your code or your agent sends a structured spec: measures, dimensions, filters, cohorts. 0sql resolves it against your governed model and returns one correct SQL statement for your warehouse, in microseconds. Nothing is guessed, nothing is invented, nothing is executed.

0sql never connects to your warehouse, so your data never leaves your network. The same spec and model always produce the same statement, with row-level security already compiled in. That is the security, determinism and reliability your application inherits the day it stops assembling SQL by hand.

Need the whole stack?Strata is this planner with execution, caching, dashboards, self-service and AI agents already around it. strata.do

response sql, adapter postgres, planned in 70 µs

Two measures from two fact tables, one conformed date. Each fact is aggregated at its own grain and stitched with a full outer join. Nothing double counts, and nobody modeled that query.

Business terms

Ask in the names your business already uses, plus who is asking. As JSON, or as one shorthand line.

  • measures
  • dimensions
  • filters
  • cohorts
  • [Measure]@m formulas
  • security context

One SQL statement

In your warehouse's dialect, ready to run. Or an error that names exactly what could not be resolved.

  • joins
  • grain
  • aggregation
  • row-level security
  • masks
  • dialect

A connection to your data

0sql holds the shape of your warehouse, never its contents. The statement runs inside your network.

  • credentials
  • connection
  • rows
  • results
  • cache

example · open source

Build a custom agentic dashboard using 0sql only for query generation.

This example shows how to use 0sql, the semantic layer as a service, to build a custom analytics dashboard. The dashboard is a chat. You type a question, an AI agent writes a 0sql query spec, 0sql returns the SQL, and the app runs that SQL on its own warehouse and draws the chart. Say “pin that” and the chart becomes a tile on the dashboard.

The app, the semantic model and the warehouse are all open source. The walkthrough builds it in three steps: deploy the model, give the agent the 0sql tools, wire up the dashboard. Switch the user in the header and the same question returns different SQL, because row-level security lives in the model, not in the prompt.

The demo app, mid-conversation. Left: the question, the agent's trace, the chart it drew. Right: the dashboard tiles. Open it full size to read the trace.

one turn, under the hood

> Which call centers have the longest average handle time?

the agent writes a spec, never SQL

0sql plans it against the deployed model

The join came from the model and the average is the measure's own formula, because an average of an average is a bug and that gets settled once, in the YAML, not in every question.

[ø] chat dashboard demo · a custom dashboard built on 0sql

The chat dashboard demo. On the left, the question “Which call centers have the longest average handle time?”, the agent's trace, the bar chart it produced and its written answer. On the right, pinned dashboard tiles: contacts per day, contacts by call center, resolution mix, average handle time by region. The chat dashboard demo. On the left, the question “Which call centers have the longest average handle time?”, the agent's trace, the bar chart it produced and its written answer. On the right, pinned dashboard tiles: contacts per day, contacts by call center, resolution mix, average handle time by region.

Model. Deploy. Request. Run.

Four steps, three of them yours. The semantic model is YAML in git; a branch deploys as a branch.

  1. 01

    model

    Tables, fields and joins in YAML

    Name a measure once. Declare joins with cardinality. The planner derives every reachable combination; you never write a query.

  2. 02

    deploy

    One command, per git branch

    Secrets are stripped before upload. The service validates the model, forms the universes, runs your tests and answers with counts and warnings.

  3. 03

    request

    A spec, or one line of shorthand

    Decorators for month grains and period-over-period, filters that land in WHERE or HAVING by themselves.

    the same, as shorthand: zsql sql --expr "month(date) asc, mom(web net paid), web net paid > 100"

  4. 04

    run

    In your code, on your warehouse

    Top five categories by revenue: a ranking CTE joined back, no window-function guesswork. Hand it to your driver.

security

Your data never leaves your network.

0sql holds the shape of your warehouse, never its contents. The statement comes back to you and runs inside your own perimeter.

your network

  • your application
  • your warehouse and its rows
  • your credentials
  • every result

spec sql

0sql

  • your semantic model
  • the planner
  • a connection
  • a single row

Specs and contexts are planned in memory, never stored or logged. What is kept.

row-level security, compiled into the statement

the policy in the model fires on the caller's groups

The context comes from your auth system with every request. A branch with policies refuses to plan without one.

determinism

Same spec, same SQL. Byte for byte.

On every deploy and every replica. Join routes and merge order are settled by name, never by row id, so planning is not a coin flip.

Pin a statement in a test. A model edit that would change the SQL your application depends on fails the deploy instead of surprising you in production.

The planner is held to byte-for-byte parity with the engine inside Strata, which has run at Netflix scale for years.

reliability

Refusals, not wrong numbers.

A measure asked for by a dimension its fact cannot reach is an error with a class and a message, never a fan-out. A hallucinated field is a 422, not a confident wrong answer.

Misspelled fields resolve by similarity when one clearly leads, and the response says so under corrections.

/explain
The node tree, join routes and microsecond timings behind a statement.

/explore
What a query can still add and stay resolvable.

/fields
Fields by name, synonym or similarity, for pickers and agents.

> Web Net Paid by Store Name

web sales never happened in a store, so there is no join to find

Every error class is documented, so an agent can read the message and fix the spec on its next turn. Error classes.

compared

Everything a semantic layer should do. Nothing it should not.

Side by side with Cube and MetricFlow, from their own documentation. Every 0sql cell links to the docs page that shows the SQL.

Read from each project's public documentation on 6 October 2026. A dash means no documented equivalent was found. Cube and MetricFlow are trademarks of their owners. Spotted a mistake? Tell us and we will fix it.

who it's for

Any caller. One contract.

A spec is JSON. Whatever builds it gets the same joins, the same grain and the same security back, and none of it has to know SQL.

plan time
~70 µs
per request, release build

warehouses
13
one model, one request, every dialect

rows we can see
0
no connection, no credentials, no logs, no cache

measure kinds
5
standard, compound, snapshot, inclusion, exclusion

0sql is the layer. Strata is the platform.

0sql returns SQL and stops there, because you are building the product around it. If what you want is the product, Strata is the same planner with everything else already attached: query execution across federated engines, aggregate awareness and hot tiers, dashboards that are good by default, self-service for non-technical users, and delivery through exports, subscriptions and Google Sheets.

It is also where the agents already live. Strata ships AI analytics over the same governed model, so a non-technical user or an agent can ask broad, cross-domain questions and get answers that are correct by construction, without you writing the retrieval layer, the chart layer or the guardrails.

The model format is the same one, so this is not a decision you have to get right today. A semantic model you write for 0sql is a semantic model Strata can run.

Stop generating SQL. Start declaring it.

Get a key, install zsql, model three tables, deploy, send your first spec. The quickstart walks through every step with the SQL that comes back.

Early access, everything included. What that means.