You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sml-reference/composite-model.md
+112-2Lines changed: 112 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,6 @@
3
3
Composite models are made up of multiple other models that all share a dimension, as well as calculations specific to the composite model itself. They are defined by `composite_model` files in SML.
4
4
5
5
When you deploy a composite model, all of its referenced objects are deployed as a single model. Note, however, that deployed composite models do not include the following objects from their referenced models:
6
-
- User defined aggregates
7
6
- Partitions
8
7
- Perspectives
9
8
- Drill-throughs
@@ -39,13 +38,16 @@ metrics:
39
38
classDiagram
40
39
CompositeModel ..> ModelReference
41
40
CompositeModel ..> MetricReference
41
+
Model *-- Aggregate
42
+
Aggregate *-- AttributeReference
42
43
namespace CompositeModels{
43
44
class CompositeModel{
44
45
String unique_name
45
46
const object_type
46
47
String label
47
48
Array~ModelReference~ models
48
49
Array~MetricReference~ metrics
50
+
Array~Aggregate~ aggregates
49
51
}
50
52
class ModelReference{
51
53
String unique_name
@@ -97,7 +99,6 @@ A list of the models that make up the composite model. These must meet the follo
97
99
- They cannot be other composite models.
98
100
- They must all have at least one dimension in common.
99
101
100
-
101
102
## metrics
102
103
103
104
-**Type:** array
@@ -112,3 +113,112 @@ The `metrics` property supports the following properties:
112
113
113
114
-`unique_name`: String, required. The unique name of the calculation.
114
115
-`folder`: String, optional. The name of the folder in which this calculation appears in BI tools.
116
+
117
+
## aggregates
118
+
119
+
-**Type:** array
120
+
-**Required:** N
121
+
122
+
The `aggregates` property in a composite model file enables you to add
123
+
user-defined aggregates (UDAs).
124
+
125
+
In general, we recommend relying on the aggregate tables
126
+
automatically generated by the semantic engine. However, there are cases
127
+
that are not covered by system-defined aggregates. For example:
128
+
129
+
-**Metrics on dimensions:** The semantic engine does not generate
130
+
aggregate tables for metrics that are local to a dimension only (a
131
+
secondary metrical attribute in the composite model).
132
+
-**Non-additive metrics:** The semantic engine does not generate
133
+
aggregate tables for non-additive metrics, which are useful for
134
+
distinct counts. This is because such an aggregate table defined for
135
+
one query would not be usable by other queries.
136
+
137
+
If you require aggregate tables that contain these types of dimensional
138
+
attributes or metrics, you should define your own manually using the
139
+
`aggregates` property.
140
+
141
+
The `aggregates` property in a composite model file supports the following
142
+
properties.
143
+
144
+
### unique_name
145
+
146
+
-**Type:** string
147
+
-**Required:** Y
148
+
149
+
The unique name of the aggregate. This must be unique within the composite model
150
+
file.
151
+
152
+
Aggregate table names used by the query engine are system-generated, but
153
+
they include the first 14 characters of the user-supplied name at the
154
+
end of the internal ID name. This name can help you identify when a
155
+
user-defined aggregate is used in a query. For example:
156
+
`as_agg_internal-id_my-uda-name`
157
+
158
+
### label
159
+
160
+
-**Type:** string
161
+
-**Required:** Y
162
+
163
+
The name of the aggregate, as it appears in the consunmption tool. This value does not
164
+
need to be unique.
165
+
166
+
### caching
167
+
168
+
-**Type:** enum
169
+
-**Required:** N
170
+
171
+
This setting will control whether the aggregate is pinned in local cache.
172
+
173
+
Supported values:
174
+
175
+
-`engine-memory`
176
+
177
+
### metrics
178
+
179
+
-**Type:** array
180
+
-**Required:** Y
181
+
182
+
A list of the metrics and calculations to include in the aggregate
183
+
definition. This is the data that is summarized in the resulting
184
+
aggregate table.
185
+
186
+
### attributes
187
+
188
+
-**Type:** array
189
+
-**Required:** N
190
+
191
+
A list of the dimension attributes to include in the aggregate
192
+
definition.
193
+
194
+
Supported properties:
195
+
196
+
-`name`: String, required. The name of the dimension attribute to
197
+
include. These values are used to group the summarized metric data in
198
+
the resulting aggregate table. Note that user-defined aggregate
199
+
definitions are fixed: they do not include every level of a hierarchy
200
+
unless they are explicitly defined.
201
+
202
+
-`dimension`: String, required. The dimension to which the attribute
203
+
defined by `name` belongs.
204
+
205
+
-`partition`: String, optional. Adds a partition to the aggregate, and
206
+
determines whether it should be defined on the key column, name
207
+
column, or both. Supported values: `name`, `key`, `name+key`
208
+
209
+
When the engine builds an instance of this aggregate, it creates
210
+
a partition for each combination of values in the dimensional
211
+
attributes. The number of partitions depends on the
212
+
left-to-right order of the attributes, as well as the number of
213
+
values for each attribute.
214
+
215
+
Essentially, the partitioning key functions as a `GROUP BY`
216
+
column. Queries against the aggregate must use this dimensional
217
+
attribute in a `WHERE` clause. A good candidate for a
218
+
partitioning key is a set of dimensional attributes that
219
+
together have a few hundred to under 1000 value combinations.
220
+
221
+
-`distribution`: String, optional. The distribution keys to use when
222
+
creating the aggregate table. If your aggregate data warehouse
223
+
supports distribution keys, then the semantic engine uses the specified keys when
0 commit comments