Examples
Worked examples for both halves of 0sql: the query specs you POST and the YAML projects they plan against. Start with the chat dashboard if you want to see the whole thing work before reading a spec. The cookbook and the tutorials below are built on the TPC-DS model; the dashboard has a model of its own.
See it work: the chat dashboard
A dashboard you talk to. You type “which call centers have the longest average handle time?”, an agent writes a 0sql query spec, 0sql plans one SQL statement with the caller’s row-level security compiled in, and the app runs it on its own warehouse and draws the chart. Say “pin that” and the chart becomes a tile. The agent never writes SQL and never sees a connection string. The build, step by step, in 34 minutes: youtu.be/6stVUI4MUio.
Four ways in, from quickest to deepest:
- Ask the agent live: the same agent on the same model, in your browser, no key and nothing to install. It shows the SQL rather than the rows.
- Chat dashboard tutorial: what the model covers, how to run the app, the agent loop and the dashboard.
- Clone the repo: a Next.js app, the complete 0sql project and the warehouse it reads. Running in about five minutes.
- The customer-service model itself is one of the two projects behind the live playground, so every request in the tutorial can be typed and planned there.
Request cookbook
Eight pages, one feature each. Each page states a problem, shows the request (JSON spec and the zsql shorthand where it can express it), the SQL that comes back, why the SQL has that shape, and the spec changes that give you the variations.
- Request cookbook: the hub, with a table of what each page demonstrates
- Cross-fact blend: two fact tables, one row per date
- Complex measures: calculations in the spec and compound measures in the model
- Cohorts and segments: populations joined into the query
- Period over period: month-over-month and friends
- Share and windows: percent of total, running and moving windows
- Filters and top-n: every filter shape and the ranking CTE
- Security context: the context your app sends and the WHERE and CASE it produces
- Level of detail: exclusion and inclusion measures requested like any other
Tutorials
- Chat dashboard tutorial: the dashboard above, built in three steps: deploy the model, give the agent the 0sql tools, wire up the dashboard
- TPC-DS tutorial: a complete walkthrough of the TPC-DS project, from
zsql initto the first query
Patterns
- Star schema: one fact, conformed dimensions
- Snowflake schema: normalized dimension chains
- Fact-dimension: fact and dimension table patterns
Recipes
- Customer 360: customer analytics across several facts
- Sales analysis: sales and revenue measures
Suggested order
- Watch the chat dashboard get built, or ask its agent a question, to see what the API is for.
- Read the Request cookbook to see what one request can ask for.
- Follow the TPC-DS tutorial to deploy the model those requests run against.
- Use the patterns and recipes when you model your own warehouse.