Skip to content

Commit 6b9914a

Browse files
authored
Mention the usage of CUBE object.
1 parent 8cfb253 commit 6b9914a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ Good examples of names:
9595
When defining cubes, you would often provide SQL snippets in `sql` and
9696
`sql_table` parameters.
9797

98+
You should include a reference to the object that the column belongs to.
99+
In most cases, this reference should be the same cube in which
100+
you are defining the element (`CUBE`).
101+
98102
Provided SQL expressions should match your database SQL dialect, e.g.,
99103
to aggregate a list of strings, you would probably pick the [`LISTAGG`
100104
function][link-snowflake-listagg] in Snowflake and the [`STRING_AGG`
@@ -109,12 +113,12 @@ cubes:
109113
110114
measures:
111115
- name: statuses
112-
sql: "STRING_AGG(status)"
116+
sql: "STRING_AGG({CUBE}.status)"
113117
type: string
114118
115119
dimensions:
116120
- name: status
117-
sql: "UPPER(status)"
121+
sql: "UPPER({CUBE}.status)"
118122
type: string
119123
```
120124

@@ -124,14 +128,14 @@ cube(`orders`, {
124128

125129
measures: {
126130
statuses: {
127-
sql: `STRING_AGG(status)`,
131+
sql: `STRING_AGG(${CUBE}.status)`,
128132
type: `string`,
129133
},
130134
},
131135

132136
dimensions: {
133137
status: {
134-
sql: `UPPER(status)`,
138+
sql: `UPPER(${CUBE}.status)`,
135139
type: `string`,
136140
},
137141
},
@@ -693,4 +697,4 @@ defining dynamic data models.
693697
[ref-custom-granularities]: /reference/data-model/dimensions#granularities
694698
[ref-style-guide]: /guides/style-guide
695699
[ref-polymorphism]: /product/data-modeling/concepts/polymorphic-cubes
696-
[ref-data-blending]: /product/data-modeling/concepts/data-blending
700+
[ref-data-blending]: /product/data-modeling/concepts/data-blending

0 commit comments

Comments
 (0)