Skip to content

Commit 8b1ab74

Browse files
committed
Fixes
1 parent f81b1ae commit 8b1ab74

File tree

13 files changed

+98
-137
lines changed

13 files changed

+98
-137
lines changed

docs/pages/product/apis-integrations/_meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
"queries": "Queries",
3-
"recipes": "Recipes",
43
"dax-api": "DAX API",
54
"mdx-api": "MDX API",
65
"microsoft-excel": "Cube Cloud for Excel",
@@ -11,4 +10,5 @@ module.exports = {
1110
"graphql-api": "GraphQL API",
1211
"javascript-sdk": "JavaScript SDK",
1312
"orchestration-api": "Orchestration API",
13+
"recipes": "Recipes"
1414
};

docs/pages/product/caching/matching-pre-aggregations.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,13 @@ pitfalls](#common-pitfalls) to understand why that part was an issue.
112112
### Common pitfalls
113113

114114
- Most commonly, a query would not match a pre-aggregation because they contain
115-
[non-additive measures][ref-measure-additivity]. See [this
116-
recipe][ref-non-additive-recipe] for workarounds.
115+
[non-additive measures][ref-measure-additivity].
116+
117+
<ReferenceBox>
118+
119+
See [this recipe][ref-non-additive-recipe] for workarounds.
120+
121+
</ReferenceBox>
117122

118123
- If a query uses any time zone other than `UTC`, please check the section on
119124
[matching time dimensions](#matching-time-dimensions) and the
@@ -130,7 +135,7 @@ configuration option.
130135
[ref-leaf-measures]: /product/data-modeling/concepts#leaf-measures
131136
[ref-calculated-measures]: /product/data-modeling/overview#4-using-calculated-measures
132137
[ref-non-strict-date-range-match]: /product/data-modeling/reference/pre-aggregations#allow_non_strict_date_range_match
133-
[ref-non-additive-recipe]: /product/data-modeling/recipes/non-additivity
138+
[ref-non-additive-recipe]: /product/caching/recipes/non-additivity
134139
[ref-conf-scheduled-refresh-time-zones]: /product/configuration/reference/config#scheduled_refresh_time_zones
135140
[ref-ungrouped-queries]: /product/apis-integrations/queries#ungrouped-query
136141
[ref-primary-key]: /product/data-modeling/reference/dimensions#primary_key

docs/pages/product/caching/recipes/non-additivity.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ age:
2121

2222
- count of unique age values (`distinct_ages`)
2323
- average age (`avg_age`)
24-
- 90th [percentile](/product/data-modeling/recipes/percentiles) of age
25-
(`p90_age`)
24+
- 90th [percentile][ref-percentile-recipe] of age (`p90_age`)
2625

2726
<CodeTabs>
2827

@@ -244,3 +243,6 @@ Please feel free to check out the
244243
[full source code](https://github.com/cube-js/cube/tree/master/examples/recipes/non-additivity)
245244
or run it with the `docker-compose up` command. You'll see the result, including
246245
queried data, in the console.
246+
247+
248+
[ref-percentile-recipe]: /product/data-modeling/recipes/percentiles

docs/pages/product/caching/using-pre-aggregations.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,21 @@ new results, then the pre-aggregation will be refreshed.
182182

183183
[Partitioning][wiki-partitioning] is an extremely effective optimization for
184184
accelerating pre-aggregations build and refresh time. It effectively "shards"
185-
the data between multiple tables, splitting them by a defined attribute. Cube
186-
can be configured to incrementally refresh only the last set of partitions
185+
the data between multiple tables, splitting them by a defined attribute.
186+
187+
Cube can be configured to incrementally refresh only the last set of partitions
187188
through the `updateWindow` property. This leads to faster refresh times due to
188189
unnecessary data not being reloaded, and even reduced cost for some databases
189190
like [BigQuery](/product/configuration/data-sources/google-bigquery) or
190191
[AWS Athena](/product/configuration/data-sources/aws-athena).
191192

193+
<ReferenceBox>
194+
195+
See [this recipe][ref-incremental-refresh-recipe] for an example of optimized
196+
incremental refresh.
197+
198+
</ReferenceBox>
199+
192200
Any `rollup` pre-aggregation can be partitioned by time using the
193201
`partition_granularity` property in [a pre-aggregation
194202
definition][ref-schema-ref-preaggs]. In the example below, the
@@ -1065,3 +1073,4 @@ or a decimal type, depending on the nature of your data.
10651073
[ref-cube-store]: /product/caching/running-in-production#architecture
10661074
[ref-cube-store-storage]: /product/caching/running-in-production#storage
10671075
[ref-member-sql]: /product/data-modeling/reference/dimensions#sql
1076+
[ref-incremental-refresh-recipe]: /product/caching/recipes/incrementally-building-pre-aggregations-for-a-date-range

docs/pages/product/data-modeling/concepts.mdx

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ We'll use a sample e-commerce database with two tables, `orders` and
2727
| 4 | 71 | 4 | 8 | 223 | 2019-12-23 00:00:00.000000 |
2828
| 5 | 64 | 5 | 5 | 75 | 2019-04-20 00:00:00.000000 |
2929

30+
We'll be following the [entity-first](#entity-first-approach) approach to
31+
designing the data model.
32+
33+
<ReferenceBox>
34+
35+
See [this recipe][ref-entities-vs-metrics-recipe] to learn about entity-first and
36+
metrics-first approaches.
37+
38+
</ReferenceBox>
39+
3040
## Cubes
3141

3242
_Cubes_ represent datasets in Cube and are conceptually similar to [views in
@@ -50,6 +60,13 @@ cubes:
5060
5161
</CodeTabs>
5262
63+
<ReferenceBox>
64+
65+
If you're using dbt, see [this recipe][ref-cube-with-dbt] to streamline defining cubes
66+
on top of dbt models.
67+
68+
</ReferenceBox>
69+
5370
You can also use the [`sql` property][ref-schema-ref-sql] to accommodate more
5471
complex SQL queries:
5572

@@ -338,8 +355,9 @@ you need to use weeks starting on Sunday, fiscal years, etc.
338355

339356
<ReferenceBox>
340357

341-
See [this recipe][ref-custom-granularity-recipe] for more custom granularity
342-
examples.
358+
See the following recipes:
359+
- For a [custom granularity][ref-custom-granularity-recipe] example.
360+
- For a [custom calendar][ref-custom-calendar-recipe] example.
343361

344362
</ReferenceBox>
345363

@@ -502,6 +520,14 @@ See the [measure type reference][ref-ref-measure-types] for details.
502520

503521
</ReferenceBox>
504522

523+
<ReferenceBox>
524+
525+
See the following recipes:
526+
- To learn how to define [average and percentile measures][ref-avg-and-percentile-recipe],
527+
- To learn how to calculate [period-over-period changes][ref-period-over-period-recipe].
528+
529+
</ReferenceBox>
530+
505531
### Measure additivity
506532

507533
Additivity is a property of measures that detemines whether measure values,
@@ -810,4 +836,9 @@ See the reference documentaton for the full list of pre-aggregation
810836
[ref-mls]: /product/auth/member-level-security
811837
[ref-ref-hierarchies]: /product/data-modeling/reference/hierarchies
812838
[ref-ref-folders]: /product/data-modeling/reference/view#folders
813-
[ref-multi-stage-calculations]: /product/data-modeling/concepts/multi-stage-calculations
839+
[ref-multi-stage-calculations]: /product/data-modeling/concepts/multi-stage-calculations
840+
[ref-entities-vs-metrics-recipe]: /product/data-modeling/recipes/designing-metrics
841+
[ref-avg-and-percentile-recipe]: /product/data-modeling/recipes/percentiles
842+
[ref-period-over-period-recipe]: /product/data-modeling/recipes/period-over-period
843+
[ref-custom-calendar-recipe]: /product/data-modeling/recipes/custom-calendar
844+
[ref-cube-with-dbt]: /product/data-modeling/recipes/dbt

docs/pages/product/data-modeling/concepts/calculated-members.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,16 @@ GROUP BY 1, 2, 3
388388

389389
**Subquery dimensions reference measures from other cubes.** Subquery dimensions
390390
provide a way to define measures that aggregate values of other measures. They can be
391-
useful to calculate [nested aggregates][ref-nested-aggregates-recipe].
391+
useful to calculate nested and filtered aggregates.
392+
393+
<ReferenceBox>
394+
395+
See the following recipes:
396+
397+
- To learn how to calculate [nested aggregates][ref-nested-aggregates-recipe].
398+
- To learn how to calculate [filtered aggregates][ref-filtered-aggregates-recipe].
399+
400+
</ReferenceBox>
392401

393402
If you have `first_cube` that is [joined][ref-joins] to `second_cube`, you can use a
394403
subquery dimension to bring `second_cube.measure` to `first_cube` as `dimension` (or
@@ -561,6 +570,7 @@ GROUP BY 1, 2
561570
[ref-schema-ref-joins]: /product/data-modeling/reference/joins
562571
[ref-decomposition-recipe]: /product/data-modeling/recipes/non-additivity#decomposing-into-a-formula-with-additive-measures
563572
[ref-nested-aggregates-recipe]: /product/data-modeling/recipes/nested-aggregates
573+
[ref-filtered-aggregates-recipe]: /product/data-modeling/recipes/filtered-aggregates
564574
[ref-non-additive]: /product/data-modeling/concepts#measure-additivity
565575
[link-postgres-division]: https://www.postgresql.org/docs/current/functions-math.html#FUNCTIONS-MATH
566576
[wiki-correlated-subquery]: https://en.wikipedia.org/wiki/Correlated_subquery

docs/pages/product/data-modeling/recipes/_meta.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ module.exports = {
66
"filtered-aggregates": "Filtered aggregates",
77
"period-over-period": "Period-over-period changes",
88
"passing-dynamic-parameters-in-a-query": "Dynamic parameters",
9-
"schema-generation": "Data model generation",
10-
"using-dynamic-measures": "Dynamic measures",
9+
"using-dynamic-measures": "Dynamic data modeling",
1110
"dynamic-union-tables": "Dynamic union tables",
1211
"string-time-dimensions": "String time dimensions",
1312
"custom-granularity": "Custom time dimension granularities",

docs/pages/product/data-modeling/recipes/designing-metrics.mdx

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Designing Metrics
1+
# Designing metrics
22

3-
Cube is a dataset-centric semantic layer, where all primary objects, cubes and views, are table-like datasets.
4-
When designing how your semantic layer will be exposed and consumed by end users, you can follow either entity-first approach or metrics-first.
5-
In both cases, views will be used to build the semantic layer interface.
3+
Cube is a dataset-centric semantic layer, where all primary objects (cubes and views)
4+
are table-like datasets. When designing how your semantic layer will be exposed and
5+
consumed by end users, you can follow either an [entity-first](#entity-first-approach)
6+
or a [metrics-first](#metrics-first-approach) approach.
67

7-
## Entity-first
8+
## Entity-first approach
89

910
In entity-first approach, views are built around entities in your data model.
1011
Views are built as denormalzied tables, bringing measures and dimensions from different cubes needed to fully decscribe the entity.
@@ -83,7 +84,8 @@ views:
8384
Views are exposed as tables in Cube SQL API, dimensions can be queried as is
8485

8586

86-
## Metrics-first
87+
## Metrics-first approach
88+
8789
In metrics-first approach, views are built around measures, or metrics, in your data model.
8890
Views are built as denormalzied tables, containing one measure and all the relevant dimensions from different cubes. These include all the dimensions you would group or filter by, and up to one time dimension.
8991
Views are usually named after that single measure.
@@ -141,30 +143,4 @@ views:
141143
142144
- status
143145
- shipped_at
144-
```
145-
146-
## Integrations with BI Tools
147-
Some metrics-based BI tools will specify requirements for the views or be able to accept additional metadata to enrich the experience.
148-
Below is an example of using the `meta` property to do this.
149-
150-
```yaml
151-
views:
152-
- name: order_count_by_order_date
153-
description: For finance team to track orders on accrual/earned basis.
154-
meta:
155-
type: metric
156-
157-
158-
cubes:
159-
- join_path: orders
160-
includes:
161-
# MEASURE
162-
- order_count
163-
164-
# TIME
165-
- created_at
166-
167-
# DIMENSIONS
168-
- status
169-
- city
170-
```
146+
```

docs/pages/product/data-modeling/recipes/schema-generation.mdx

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/pages/product/data-modeling/recipes/style-guide.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cube Style Guide
1+
# Cube style guide
22

33
This style guide includes best practices on data modeling in Cube.
44

0 commit comments

Comments
 (0)