4. Build the data model¶
Step 4 of 5 — setup step 4, The data model. At the end of it, Cube is serving a model of the tables you picked, and the portal opens on Chat.
What you are building¶
A semantic layer is a description of your data that a computer can check: which tables matter, what each column means, how tables join, which numbers can be added up (measures) and which values you group and filter by (dimensions). Every question is answered through it, so the agent can only use joins and formulas the model defines.
Pick the tables¶
One fact table ticked; the two dimension tables it joins to come with it.
- Schema selects which schema to list. Filter narrows the list.
- All, None and Facts select quickly. Facts are tables nothing points at — where additive numbers usually live.
- Tables your selection points at through foreign keys are ticked for you: Included because your selection references it.
- The footer warns about joins that will be dropped, and tables with no key that nothing can join to.
- Re-read picks up a schema change in the warehouse.
Tick Also write descriptions and views with AI to run all four steps. Without it the model is cubes only — no descriptions and no views — and the agent has less to go on.
Click Build the model from N tables. A progress panel shows each step, the table it is on, and a log. Cancel stops it.
If Describe or Views fails, the cubes are already built and serving. You can carry on and ask the model editor's assistant for descriptions and views instead.
What the build does¶
| Step | What happens |
|---|---|
| Read the database | Reads every schema and table, with keys and foreign keys. Runs on its own when you arrive. Nothing is written to the model |
| Build cubes | Each table you picked becomes a cube, with its keys and joins |
| Describe with AI | The AI writes a description of each table and column, and suggests measures. One model call per table — the slow part |
| Build views | Builds views: clean, joined surfaces for questions, grouped into folders |
The AI returns decisions, never files. The portal writes the files, and Cube is the judge: each build goes to a temporary branch first, and only if Cube compiles it does it replace what is served. If Cube refuses, the message says what failed and nothing was replaced.
The words¶
| Word | Means | Example |
|---|---|---|
| Cube | One business thing, from one table | fact_daily_sales |
| Measure | A number you can add up or count | total_revenue |
| Dimension | A value you group or filter by | region, sale_date |
| Join | How two cubes relate | a sale belongs to a store |
| View | A joined surface the agent asks questions against | daily_sales = sales + stores + items |
| Folder | A group of members inside a view | "Store", "Money" |
| Segment | A named, reusable filter | orders.paid_only |
When the build finishes, the portal opens on Chat.