Skip to content

Commit b9521e4

Browse files
authored
docs: Descriptions in segments (#8622)
1 parent 1c63de0 commit b9521e4

File tree

5 files changed

+87
-28
lines changed

5 files changed

+87
-28
lines changed

docs/pages/reference/data-model/cube.mdx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,20 @@ cubes:
137137
138138
### `description`
139139

140-
Use a description in your cubes to allow your team to better understand what
141-
this cube is about. It is a very simple and yet useful tool that gives a hint to
142-
everyone and makes sure data is interpreted correctly by users.
140+
This parameter provides a human-readable description of a cube.
141+
When applicable, it will be displayed in [Playground][ref-playground] and exposed
142+
to data consumers via [APIs and integrations][ref-apis].
143+
144+
A description can give a hint both to your team and end users, making sure they
145+
interpret the data correctly.
143146

144147
<CodeTabs>
145148

146149
```javascript
147150
cube(`orders`, {
148151
sql_table: `orders`,
149152
title: `Product Orders`,
150-
description: `All orders related information`,
153+
description: `All orders-related information`,
151154
});
152155
```
153156

@@ -156,7 +159,7 @@ cubes:
156159
- name: orders
157160
sql_table: orders
158161
title: Product Orders
159-
description: All orders related information
162+
description: All orders-related information
160163
```
161164
162165
</CodeTabs>
@@ -580,6 +583,7 @@ cubes:
580583
581584
</CodeTabs>
582585
586+
583587
[ref-config-driverfactory]: /reference/configuration/config#driverfactory
584588
[ref-config-ext-ctx]: /reference/configuration/config#extend_context
585589
[ref-config-queryrewrite]: /reference/configuration/config#queryrewrite
@@ -591,8 +595,10 @@ cubes:
591595
[ref-restapi-sql]: /reference/rest-api#v1sql
592596
[ref-sec-ctx]: /product/auth/context
593597
[ref-naming]: /product/data-modeling/syntax#naming
598+
[ref-playground]: /product/workspace/playground
599+
[ref-apis]: /product/apis-integrations
594600
[ref-ref-measures]: /reference/data-model/measures
595601
[ref-ref-dimensions]: /reference/data-model/dimensions
596602
[ref-ref-segments]: /reference/data-model/segments
597603
[ref-ref-joins]: /reference/data-model/joins
598-
[ref-ref-pre-aggs]: /reference/data-model/pre-aggregations
604+
[ref-ref-pre-aggs]: /reference/data-model/pre-aggregations

docs/pages/reference/data-model/dimensions.mdx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Any dimension should have the following properties: `name`, `sql` and `type`.
1414

1515
## Parameters
1616

17-
### name
17+
### `name`
1818

1919
The `name` parameter serves as the identifier of a dimension. It must be unique
2020
among all dimensions, measures, and segments within a cube and follow the
@@ -56,7 +56,7 @@ cubes:
5656

5757
</CodeTabs>
5858

59-
### case
59+
### `case`
6060

6161
The `case` statement is used to define dimensions based on SQL conditions.
6262

@@ -152,9 +152,11 @@ cube(`products`, {
152152
});
153153
```
154154

155-
### description
155+
### `description`
156156

157-
You can add details to a dimension's definition via the `description` property:
157+
This parameter provides a human-readable description of a dimension.
158+
When applicable, it will be displayed in [Playground][ref-playground] and exposed
159+
to data consumers via [APIs and integrations][ref-apis].
158160

159161
<CodeTabs>
160162

@@ -186,7 +188,7 @@ cubes:
186188
187189
</CodeTabs>
188190
189-
### format
191+
### `format`
190192

191193
`format` is an optional parameter. It is used to format the output of dimensions
192194
in different ways, for example, a link for `external_url`. Please refer to the
@@ -223,7 +225,7 @@ cubes:
223225
224226
</CodeTabs>
225227
226-
### meta
228+
### `meta`
227229

228230
Custom metadata. Can be used to pass any information to the frontend.
229231

@@ -260,7 +262,7 @@ cubes:
260262
261263
</CodeTabs>
262264
263-
### primary_key
265+
### `primary_key`
264266

265267
Specify which dimension is a primary key for a cube. The default value is
266268
`false`.
@@ -304,7 +306,7 @@ cubes:
304306
305307
</CodeTabs>
306308
307-
### propagate_filters_to_sub_query
309+
### `propagate_filters_to_sub_query`
308310

309311
When this statement is set to `true`, the filters applied to the query will be
310312
passed to the [subquery][self-subquery].
@@ -341,7 +343,7 @@ cubes:
341343
342344
</CodeTabs>
343345
344-
### public
346+
### `public`
345347

346348
<InfoBox>
347349

@@ -383,7 +385,7 @@ cubes:
383385
384386
</CodeTabs>
385387
386-
### sql
388+
### `sql`
387389

388390
`sql` is a required parameter. It can take any valid SQL expression depending on
389391
the `type` of the dimension. Please refer to the [Dimension
@@ -418,7 +420,7 @@ cube(`orders`, {
418420

419421
</CodeTabs>
420422

421-
### sub_query
423+
### `sub_query`
422424

423425
The `sub_query` statement allows you to reference a measure in a dimension. It's
424426
an advanced concept and you can learn more about it [here][ref-subquery].
@@ -453,7 +455,7 @@ cubes:
453455
454456
</CodeTabs>
455457
456-
### title
458+
### `title`
457459

458460
You can use the `title` parameter to change a dimension's displayed name. By
459461
default, Cube will humanize your dimension key to create a display name. In
@@ -489,7 +491,7 @@ cubes:
489491
490492
</CodeTabs>
491493
492-
### type
494+
### `type`
493495

494496
`type` is a required parameter. There are various types that can be assigned to
495497
a dimension. Please refer to the [Dimension Types][ref-schema-ref-dims-types]
@@ -523,6 +525,7 @@ cubes:
523525
524526
</CodeTabs>
525527
528+
526529
[ref-schema-ref-joins]: /reference/data-model/joins
527530
[ref-subquery]: /product/data-modeling/concepts/calculated-members#subquery-dimensions
528531
[self-subquery]: #sub-query
@@ -531,3 +534,5 @@ cubes:
531534
/reference/data-model/types-and-formats#dimension-types
532535
[ref-schema-ref-dims-formats]:
533536
/reference/data-model/types-and-formats#dimension-formats
537+
[ref-playground]: /product/workspace/playground
538+
[ref-apis]: /product/apis-integrations

docs/pages/reference/data-model/measures.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ cubes:
5858
5959
### `description`
6060

61-
You can add details to a measure’s definition via the `description` parameter:
61+
This parameter provides a human-readable description of a measure.
62+
When applicable, it will be displayed in [Playground][ref-playground] and exposed
63+
to data consumers via [APIs and integrations][ref-apis].
6264

6365
<CodeTabs>
6466

@@ -70,7 +72,7 @@ cube(`orders`, {
7072
orders_count: {
7173
sql: `id`,
7274
type: `count`,
73-
description: `count of all orders`,
75+
description: `Count of all orders`,
7476
},
7577
},
7678
});
@@ -83,7 +85,7 @@ cubes:
8385

8486
measures:
8587
- name: orders_count
86-
description: count of all orders
88+
description: Count of all orders
8789
sql: id
8890
type: count
8991
```
@@ -530,9 +532,12 @@ cubes:
530532
You can create calculated measures from several joined cubes. In this case, a
531533
join will be created automatically.
532534
535+
533536
[ref-schema-ref-types-formats-measures-types]:
534537
/reference/data-model/types-and-formats#measure-types
535538
[ref-schema-ref-types-formats-measures-formats]:
536539
/reference/data-model/types-and-formats#measure-formats
537540
[ref-drilldowns]: /guides/recipes/data-exploration/drilldowns
538541
[ref-naming]: /product/data-modeling/syntax#naming
542+
[ref-playground]: /product/workspace/playground
543+
[ref-apis]: /product/apis-integrations

docs/pages/reference/data-model/segments.mdx

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ After defining a segment, you can pass it in [query object][ref-backend-query]:
102102

103103
## Parameters
104104

105-
### name
105+
### `name`
106106

107107
The `name` parameter serves as the identifier of a segment. It must be unique
108108
among all segments, dimensions, and measures within a cube and follow the
@@ -134,7 +134,41 @@ cubes:
134134
135135
</CodeTabs>
136136
137-
### public
137+
### `description`
138+
139+
This parameter provides a human-readable description of a segment.
140+
When applicable, it will be displayed in [Playground][ref-playground] and exposed
141+
to data consumers via [APIs and integrations][ref-apis].
142+
143+
<CodeTabs>
144+
145+
```javascript
146+
cube(`users`, {
147+
// ...
148+
149+
segments: {
150+
sf_users: {
151+
sql: `${CUBE}.location = 'San Francisco'`,
152+
description: `Users from San Francisco`
153+
}
154+
}
155+
})
156+
```
157+
158+
```yaml
159+
cubes:
160+
- name: users
161+
# ...
162+
163+
segments:
164+
- name: sf_users
165+
sql: "{CUBE}.location = 'San Francisco'"
166+
description: Users from San Francisco
167+
```
168+
169+
</CodeTabs>
170+
171+
### `public`
138172

139173
The `public` property is used to manage the visibility of a segment. Valid
140174
values for `public` are `true` and `false`. When set to `false`, this segment
@@ -164,7 +198,7 @@ cubes:
164198
165199
</CodeTabs>
166200
167-
### sql
201+
### `sql`
168202

169203
The `sql` parameter defines how a segment would filter out a subset of data. It
170204
takes any SQL expression that would be valid within a `WHERE` statement.
@@ -301,6 +335,9 @@ cubes:
301335
302336
</CodeTabs>
303337
338+
304339
[ref-backend-query]: /product/apis-integrations/rest-api/query-format
305340
[ref-schema-gen]: /guides/recipes/code-reusability/schema-generation
306341
[ref-naming]: /product/data-modeling/syntax#naming
342+
[ref-playground]: /product/workspace/playground
343+
[ref-apis]: /product/apis-integrations

docs/pages/reference/data-model/view.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ views:
3434
3535
### `description`
3636

37-
A description of the view allows your team to better understand what its purpose
38-
is. It is a very simple and yet useful tool that gives a hint to everyone and
39-
ensures that data is interpreted correctly by users.
37+
This parameter provides a human-readable description of a view.
38+
When applicable, it will be displayed in [Playground][ref-playground] and exposed
39+
to data consumers via [APIs and integrations][ref-apis].
40+
41+
A description can give a hint both to your team and end users, making sure they
42+
interpret the data correctly.
4043

4144
<CodeTabs>
4245

@@ -302,8 +305,11 @@ matching algorithm used for Cubes. As a consequence, all measures and dimensions
302305
included in pre-aggregation should be leaf members in order to be matched by
303306
view query.
304307
308+
305309
[ref-recipe-control-access-cubes-views]:
306310
/guides/recipes/access-control/controlling-access-to-cubes-and-views
307311
[ref-schema-joins-direction]:
308312
/product/data-modeling/concepts/working-with-joins#directions-of-joins
309313
[ref-naming]: /product/data-modeling/syntax#naming
314+
[ref-playground]: /product/workspace/playground
315+
[ref-apis]: /product/apis-integrations

0 commit comments

Comments
 (0)