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.
Ask in the names your business already uses, plus who is asking. As JSON, or as one shorthand line.
In your warehouse's dialect, ready to run. Or an error that names exactly what could not be resolved.
0sql holds the shape of your warehouse, never its contents. The statement runs inside your network.
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.
{ "projections": [ { "field": "Call Center" }, { "field": "Average Contact Duration Secs", "alias": "Average Handle Time Secs", "order_by": "desc" } ] } ↓ 0sql plans it against the deployed model planned.sql SELECT T1."call_center_desc" AS "Call Center", sum(T0."contact_duration_secs") * 1.0 / nullif(count(*), 0) AS "Average Handle Time Secs" FROM cs_contact_f T0 LEFT JOIN cs_call_center_d T1 ON T0.call_center_id = T1.call_center_id GROUP BY T1."call_center_desc" ORDER BY sum(T0."contact_duration_secs") * 1.0 / nullif(count(*), 0) desc 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.
Four steps, three of them yours. The semantic model is YAML in git; a branch deploys as a branch.
Name a measure once. Declare joins with cardinality. The planner derives every reachable combination; you never write a query.
name: Web Sales physical_name: web_sales datasource: warehouse cost: 100 fields: - type: measure name: Web Net Paid data_type: decimal expression: sql: sum(ws_net_paid) models/sales/rel.sales.yml datasource: warehouse web_sales_item: left: Web Sales right: Item sql: left.ws_item_sk = right.i_item_sk cardinality: many_to_one 02 deploy
Secrets are stripped before upload. The service validates the model, forms the universes, runs your tests and answers with counts and warnings.
$ zsql deploy deploy tpcds (6120 bytes) as tpcds/main (the production branch) to https://app.0sql.io deployed tpcds/main: 6 tables, 41 fields, 7 joins, 11 paths, 1 policies PASSED category by net paid tests: 1 passed, 0 failed 03 request
Decorators for month grains and period-over-period, filters that land in WHERE or HAVING by themselves.
{ "spec": { "projections": [ {"field": "Date", "decorators": [{"type": "truncate", "grain": "month"}], "order_by": "asc"}, {"field": "Web Net Paid", "decorators": [{"type": "temporalize", "transform": "month_over_month"}]} ], "filters": [{"field": "Web Net Paid", "predicate": "greater_than", "value": "100"}] } } = the same, as shorthand: zsql sql --expr "month(date) asc, mom(web net paid), web net paid > 100"
Top five categories by revenue: a ranking CTE joined back, no window-function guesswork. Hand it to your driver.
WITH ag5c9bb8d550197b3a219ae50f0b427905 AS ( SELECT T1."i_category" AS "dim30d09b7", sum(T0."ws_net_paid") AS "msr0c0d023" FROM web_sales T0 JOIN item T1 ON T0.ws_item_sk = T1.i_item_sk GROUP BY T1."i_category" ORDER BY sum(T0."ws_net_paid") desc LIMIT 5 ) SELECT sum(T0."ws_net_paid") AS "Web Net Paid", T1."i_category" AS "Category" FROM web_sales T0 JOIN item T1 ON T0.ws_item_sk = T1.i_item_sk INNER JOIN ag5c9bb8d550197b3a219ae50f0b427905 AS A2 ON T1."i_category" = A2.dim30d09b7 GROUP BY T1."i_category" security
Specs and contexts are planned in memory, never stored or logged. What is kept.
row-level security, compiled into the statement
{ "spec": {"projections": [{"field": "Country"}]}, "context": { "email": "tank@matrix.com", "groups": [ {"name": "CC-TMNT", "tags": ["call_center_id:TMNT"]}, {"name": "CC-AVCL", "tags": ["call_center_id:AVCL"]} ] } } ↓ the policy in the model fires on the caller's groups response.sql SELECT T0."cc_country" AS "Country" FROM call_center T0 WHERE LOWER(T0."cc_call_center_id") IN ('tmnt', 'avcl') The context comes from your auth system with every request. A branch with policies refuses to plan without one.
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.
name: revenue by category projections: - Category - Net Paid assert_sql: | SELECT T1."i_category" AS "Category", sum(T0."ss_net_paid") AS "Net Paid" FROM store_sales T0 JOIN item T1 ON T0.ss_item_sk = T1.i_item_sk GROUP BY T1."i_category" ↓ runs on every deploy terminal $ zsql deploy deploy tpcds (6120 bytes) as tpcds/main (the production branch) to https://app.0sql.io deployed tpcds/main: 6 tables, 41 fields, 7 joins, 11 paths, 1 policies PASSED category by net paid tests: 1 passed, 0 failed reliability
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.
{ "error": { "class": "Unresolvable", "message": "Could not find Universe for measure: Web Net Paid, id: 376" } } Every error class is documented, so an agent can read the message and fix the spec on its next turn. Error classes.
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.
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.
A combination the model cannot have comes back as an error with a reason, not a confident wrong number.
A query builder in your product, with no SQL generator to write.
Your UI sends specs, your backend runs the statement, and the context decides which rows each tenant sees.
Notebooks, internal tools and new front ends ask by name and get the same statement, in every dialect.
Model in git. Deploy per branch. Test the SQL in CI.
Hand every team a read-only query key and keep the warehouse credentials to yourself.
The adapter on the datasource decides quoting, date functions, join support and CTE strategy. Hot and cold tiers, partitions and aggregate tables route each request to the cheapest table that can answer it.
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.
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.




