Skip to content

Commit 3776b78

Browse files
Merge branch 'main' of github.com:semanticdatalayer/SML into ATSCALE-26533-constraint-translations
2 parents 8c35bd3 + 86dc14d commit 3776b78

File tree

3 files changed

+114
-30
lines changed

3 files changed

+114
-30
lines changed

sml-reference/dimension.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,14 @@ classDiagram
154154
Dimension *-- Hierarchy
155155
Dimension *-- LevelAttribute
156156
Dimension *-- CalculationGroup
157+
Hierarchy *-- DefaultMember
157158
Hierarchy *-- Level
158159
LevelAttribute *-- CustomEmptyMember
160+
LevelAttribute *-- SharedDegenerateColumns
159161
Level *-- SecondaryAttribute
160162
Level *-- MetricalAttribute
161163
Level *-- Alias
164+
Level *-- ParallelPeriods
162165
CalculationGroup *-- CalculatedMembers
163166
SecondaryAttribute *-- CustomEmptyMember
164167
Alias *-- CustomEmptyMember
@@ -182,11 +185,12 @@ namespace Dimensions{
182185
Object to
183186
String role_play
184187
String type
185-
Boolean m2m
186188
}
187189
class From{
188190
String dataset
189-
Array~Column~ columns
191+
Array~String~ join_columns
192+
String hierarchy
193+
String level
190194
}
191195
class To{
192196
String dimension
@@ -196,17 +200,22 @@ namespace Dimensions{
196200
class Hierarchy{
197201
String unique_name
198202
String label
203+
String description
199204
String folder
200205
enum filter_empty
206+
DefaultMember default_member
201207
Array~Level~ levels
202208
}
209+
class DefaultMember{
210+
String expression
211+
Boolean apply_only_when_in_query
212+
}
203213
class Level{
204214
String unique_name
205-
String description
206215
Array~SecondaryAttribute~ secondary_attributes
207216
Array~Alias~ aliases
208217
Array~MetricalAttribute~ metrics
209-
String default_member
218+
Array~ParallelPeriods~ parallel_periods
210219
Boolean is_hidden
211220
}
212221
class Alias{
@@ -218,11 +227,11 @@ namespace Dimensions{
218227
String sort_column
219228
String folder
220229
Boolean is_hidden
230+
String format
221231
Boolean exclude_from_dim_agg
232+
Boolean is_aggregatable
222233
Boolean exclude_from_fact_agg
223234
Array~CustomEmptyMember~ custom_empty_member
224-
Array~String~ allowed_calcs_for_dma
225-
Object role
226235
}
227236
class MetricalAttribute{
228237
String unique_name
@@ -235,11 +244,16 @@ namespace Dimensions{
235244
String column
236245
Boolean is_hidden
237246
Boolean exclude_from_dim_agg
247+
Boolean is_aggregatable
238248
Boolean exclude_from_fact_agg
239249
CustomEmptyMember custom_empty_member
240250
enum unrelated_dimensions_handling
241251
Array~String~ allowed_calcs_for_dma
242252
}
253+
class ParallelPeriods{
254+
String level
255+
Array~String~ key_columns
256+
}
243257
class LevelAttribute{
244258
String unique_name
245259
String label
@@ -252,10 +266,21 @@ namespace Dimensions{
252266
Boolean is_hidden
253267
Boolean is_unique_key
254268
Boolean exclude_from_dim_agg
269+
Boolean is_aggregatable
255270
Boolean exclude_from_fact_agg
256271
String time_unit
257272
Int constraint_translation_rank
258273
Array~String~ allowed_calcs_for_dma
274+
CustomEmptyMember custom_empty_member
275+
String folder
276+
Array~SharedDegenerateColumns~ shared_degenerate_columns
277+
}
278+
class SharedDegenerateColumns {
279+
String dataset
280+
String name_column
281+
String sort_column
282+
Array~String~ key_columns
283+
Boolean is_unique_key
259284
}
260285
class SecondaryAttribute{
261286
String unique_name
@@ -267,9 +292,12 @@ namespace Dimensions{
267292
String sort_column
268293
Array~String~ key_columns
269294
Boolean exclude_from_dim_agg
295+
Boolean is_aggregatable
270296
Boolean exclude_from_fact_agg
271297
Array~String~ allowed_calcs_for_dma
272-
Array~CustomEmptyMember~ custom_empty_member
298+
CustomEmptyMember custom_empty_member
299+
Boolean is_hidden
300+
Boolean contains_unique_names
273301
}
274302
class CustomEmptyMember{
275303
Array~String~ key
@@ -289,6 +317,7 @@ namespace Dimensions{
289317
String format
290318
String expression
291319
Boolean use_input_metric_format
320+
String template
292321
}
293322
}
294323
```
@@ -326,14 +355,6 @@ need to be unique.
326355

327356
A description of the dimension.
328357

329-
## folder
330-
331-
- **Type:** string
332-
- **Required:** N
333-
334-
The name of the folder in which the calculation group appears in BI
335-
tools.
336-
337358
## type
338359

339360
- **Type:** enum
@@ -346,6 +367,13 @@ Supported values:
346367
- `standard`: Can have any type of hierarchy.
347368
- `time`: Must have a time hierarchy.
348369

370+
## is_degenerate
371+
372+
- **Type:** boolean
373+
- **Required:** N
374+
375+
Determines whether the dimension is degenerate.
376+
349377
## hierarchies
350378

351379
- **Type:** array
@@ -514,6 +542,13 @@ Defines the individual calculated members in the group.
514542

515543
A description of the calculation group.
516544

545+
## folder
546+
547+
- **Type:** string
548+
- **Required:** N
549+
550+
The name of the folder in which the calculation group is displayed in BI tools.
551+
517552
# Calculated Members Properties
518553

519554
## unique_name
@@ -707,6 +742,13 @@ For levels in time dimensions only. Defines a custom parallel period for the lev
707742

708743
You can define as many parallel periods for a level as needed.
709744

745+
## is_hidden
746+
747+
- **Type:** boolean
748+
- **Required:** N
749+
750+
Determines whether the level is visible in BI tools.
751+
710752
# Secondary Attributes Properties
711753

712754
## unique_name
@@ -819,7 +861,7 @@ Excludes this attribute from system generated fact-based aggregates. This is use
819861

820862
## custom\_empty\_member
821863

822-
- **Type:** array
864+
- **Type:** object
823865
- **Required:** N
824866

825867
Defines a custom empty member for the attribute. This feature allows fact data with missing or invalid foreign key values to be isolated and independently aggregated from those with valid foreign key values. Because fact records with invalid foreign keys are aggregated separately from records referencing valid dimension members, analysts can easily spot data integrity problems and further investigate them. Use this feature to ensure that un-joinable values are included in query results and aggregated under a specially designated dimension member called the Custom Empty Member.
@@ -1344,7 +1386,7 @@ A list of the empty member values to use for key fields.
13441386

13451387
The empty member value to use for name fields.
13461388

1347-
## sort
1389+
## sort_name
13481390

13491391
- **Type:** string
13501392
- **Required:** N

sml-reference/metric.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ Defines the metric as a semi-additive metric.
148148
- **Type:** string
149149
- **Required:** Y
150150

151-
Determines whether the metric is First Non-Empty or Last Non-Empty.
151+
Determines whether the metric is First Non-Empty, Last Non-Empty, First Child or Last Child.
152152

153153
Supported values:
154154
- `first`
155155
- `last`
156+
- `first_child` - introduced in version `1.1`
157+
- `last_child` - introduced in version `1.1`
156158

157159
### relationships
158160

sml-reference/model.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ classDiagram
195195
Aggregate *-- AttributeReference
196196
Perspective *-- PerspectiveDimension
197197
PerspectiveDimension *-- PerspectiveHierarchy
198+
Drillthrough *-- AttributeReferenceDrillthrough
198199
namespace Models{
199200
class Model{
200201
String unique_name
@@ -207,8 +208,9 @@ namespace Models{
207208
Array~Aggregate~ aggregates
208209
Array~Perspective~ perspectives
209210
Array~Drillthrough~ drillthroughs
210-
Array~Partition~ partition
211+
Array~Partition~ partitions
211212
Boolean include_default_drillthrough
213+
Object overrides
212214
}
213215
class Relationship{
214216
String unique_name
@@ -243,13 +245,19 @@ namespace Models{
243245
String unique_name
244246
String notes
245247
Array~String~ metrics
246-
Array~AttributeReference~ attributes
248+
Array~AttributeReferenceDrillthrough~ attributes
249+
}
250+
class AttributeReferenceDrillthrough{
251+
String name
252+
String dimension
253+
Array~String~ relationships_path
247254
}
248255
class AttributeReference{
249256
String name
250257
String dimension
251258
String partition
252259
String distribution
260+
Array~String~ relationships_path
253261
}
254262
class Partition{
255263
String unique_name
@@ -271,14 +279,12 @@ namespace Models{
271279
}
272280
class PerspectiveDimension{
273281
String name
274-
Boolean visible
275282
Array~PerspectiveHierarchy~ hierarchies
276-
Array~String~ secondaryattributes
277-
Array~String~ metrics
283+
Array~String~ secondary_attributes
284+
Array~String~ relationships_path
278285
}
279286
class PerspectiveHierarchy{
280287
String name
281-
Boolean visible
282288
Array~String~ levels
283289
}
284290
}
@@ -498,18 +504,18 @@ Supported properties:
498504
- `name`: String, required. The name of the dimension to include in the
499505
perspective.
500506

501-
- `prefixes`: Array, optional.
502-
503507
- `hierarchies`: Array, optional. A list of the specific hierarchies
504508
within the `name` dimension to include in the perspective. Supported
505509
properties:
506-
- `name`: String, required. The name of the hierarchy.
507-
- `levels`: Array, optional. A list of the levels within the
508-
hierarchy to include in the perspective.
510+
- `name`: String, required. The name of the hierarchy.
511+
- `levels`: Array, optional. A list of the levels within the
512+
hierarchy to include in the perspective.
509513

510-
- `secondaryattributes`: Array, optional. A list of the dimension's
514+
- `secondary_attributes`: Array, optional. A list of the dimension's
511515
secondary attributes to include in the perspective.
512516

517+
- `relationships_path`: Array, optional. A list of relationships path.
518+
513519
## drillthroughs
514520

515521
- **Type:** array
@@ -563,6 +569,7 @@ Supported properties:
563569
drillthrough.
564570
- `dimension`: String, optional. The dimension that the attribute
565571
defined by `name` appears in.
572+
- `relationships_path`: Array, optional. A list of relationships path.
566573

567574
## aggregates
568575

@@ -754,3 +761,36 @@ you want to set for it at the model level. For example:
754761

755762
dataset1:
756763
create_hinted_aggregate: true
764+
765+
## overrides
766+
767+
- **Type:** object
768+
- **Required:** N
769+
770+
The `overrides` property in a model file enables the creation of query name overrides for metrics and degenerate dimensions referenced in а model.
771+
This scenario arises from legacy projects where metrics or dimensions in different models can use the same `unique_name` when deployed.
772+
Since project scope uniqueness is enforced these metrics/dimensions are required have a different `unique_name` value in the repo.
773+
When a model is deployed the overridden `unique_name` is replaced by the original value.
774+
The best practice is to never use the same `unique_name` for different objects across models so overrides should only be used when migrating
775+
from a legacy model and wanting to maintain the same query name for existing interfaces.
776+
777+
**Note:** This applies only for degenerate dimensions, NOT the dimensions part of relationships.
778+
779+
- The object key must be a metric or a dimension referenced in the model.
780+
781+
### query_name
782+
783+
- **Type:** string
784+
- **Required:** Y
785+
786+
The query name that the metric or dimension should be resolved to.
787+
788+
Sample `overrides`:
789+
790+
```yaml
791+
overrides:
792+
salesamount:
793+
query_name: deployed query name for metric
794+
Color Dimension:
795+
query_name: deployed query name for dimension
796+
```

0 commit comments

Comments
 (0)