Skip to content

Commit 56653ca

Browse files
committed
no-mistakes(document): Cube docs: derived measure, value-object refusal
1 parent c7c74d4 commit 56653ca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎docs/features/cube-export.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ somewhere to go: an `identity.reference` onto an entity that is not a cube makes
327327
| `measure.ratio` | `type: number`. Postgres: `CAST({num} AS NUMERIC) / NULLIF({den}, 0)`. MySQL: `{num} / NULLIF({den}, 0)`. |
328328
| a `measure.aggregate` with `@default: n` | two members. `<m>Raw` is the aggregate as the rows above write it (its `type`, `sql` and `filters`), with `public: false`. `<m>` is `type: number` (`type: boolean` for an `any` or `all`, where `n` is written `TRUE` / `FALSE` on Postgres and `1` / `0` on MySQL), `sql: 'COALESCE({<m>Raw}, n)'`, and carries the measure's `title` and `description`. |
329329
| a `measure.ratio` with `@default: n` | `type: number`, the quotient above inside `COALESCE(…, n)` |
330+
| `measure.derived` | `type: number`, `sql` the `@expr` over the operand measures' members (each operand is its full Cube expression, as in a ratio). `divide` is `CAST(x AS NUMERIC) / NULLIF(y, 0)` on Postgres and `x / NULLIF(y, 0)` on MySQL. A `@expr` that reads a dimension (not a measure) is `ERR_CUBE_DERIVED_DIMENSION`. |
330331

331332
In a ratio, `{num}` and `{den}` are references to the two operand measures, so each operand is
332333
its full Cube expression, condition included, and an operand need not be listed in any report.
@@ -491,6 +492,8 @@ are printed in its messages and are not loader codes.
491492
| `ERR_CUBE_NAME_COLLISION` | two cubes, or a cube and a view, would have one name |
492493
| `ERR_CUBE_UNESCAPABLE_LITERAL` | a literal, an identifier or free text that is raw-wrapped (it holds a Jinja opener) holds `endraw` |
493494
| `ERR_CUBE_UNSUPPORTED_DIALECT` | the dialect is neither `postgres` nor `mysql` and the run would write a cube |
495+
| `ERR_CUBE_VALUE_OBJECT_MEMBER` | an `@of` names a value-object member (`Entity.field.member`); the exporter does not map it |
496+
| `ERR_CUBE_DERIVED_DIMENSION` | a `measure.derived` `@expr` reads a dimension rather than a measure |
494497

495498
## Which files a run writes
496499

@@ -676,7 +679,8 @@ jobs API) before a query can use them.
676679
- **No `sqlite` or `d1`.** See [Dialects](#wiring-it).
677680
- **No `extends`, no `refresh_key`, no partitions, no `format`.** The exporter writes cubes, and
678681
a Cube view only for a served `@spine` report.
679-
- **No derived measure.** `measure.derived` is not registered, so there is nothing to map.
682+
- **No member of a value object.** An `@of` naming `Entity.field.member` is `ERR_CUBE_VALUE_OBJECT_MEMBER`
683+
(see [What the exporter refuses](#what-the-exporter-refuses)). Read it through a report view instead.
680684

681685
## Compatibility
682686

0 commit comments

Comments
 (0)