Models
Models
Save a query as a named, versioned model that your team, the agent and connected AI tools all query by name.
A model is a named, versioned query. Once it's saved, anyone in the workspace can select from it like a table:
SELECT region, count(*) FROM active_customers GROUP BY region
Models are how a team agrees on what its numbers mean. Every company has its own definition of a qualified opportunity, an active customer or net revenue, and those definitions don't live in any source system. Save them as models, and every query, every published tab, the agent and any connected AI tool use the same one.
Creating a model
From a SQL tab or an agent answer, choose Save as model and fill in:
- Name: how the model is queried, for example
active_customers. Use lower snake case. Names are unique in the workspace. - Description: what the model returns, and any definitions in it, such as "Customers with a usage event in the last 30 days, excluding internal accounts." People, the agent and connected AI tools read this to decide whether the model is the right one to use.
The model shows up in autocomplete for everyone in the workspace straight away.
Building on other models
A model can select from other models. A common pattern is to clean up a source in one model (opportunities_clean), define a metric on top of it (qualified_pipeline), and report from that. Fix the base model, and everything built on it picks up the fix.
Versions
Every time a model's SQL changes, a new version is saved (v2, v3, and so on), along with who made the change and an optional What changed note. History on the Models page lists every version.
Editing a model
Choose Edit on the Models page. The model opens in a SQL tab that stays linked to it, and saving there creates its next version.
If someone else saves a newer version while you're editing, Datachef warns you before you save. To replace their version with yours, you have to tick I understand. Your change is never silently lost, and neither is theirs.
Who can do what
| Role | Models |
|---|---|
| Viewer | Query models. Open in SQL opens a copy to experiment with. |
| Editor | Create, edit and delete models |
| Admin | Everything an editor can do |
Models are always current
A model is a saved query, not a stored copy of its result. It runs against the latest synced data each time it's queried, so it's as fresh as the tables it reads.
Something missing or wrong on this page? Tell us