Skip to content

Commit 86dc14d

Browse files
Merge pull request #22 from semanticdatalayer/ATSCALE-26548-review-model
[ATSCALE-26548] Review SML spec for Model
2 parents b2b86d6 + 7d1e0c4 commit 86dc14d

File tree

1 file changed

+53
-14
lines changed

1 file changed

+53
-14
lines changed

sml-reference/model.md

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ files. Those defined in model files override their counterparts in
1212

1313
Sample `model` file:
1414

15-
```
15+
```yaml
1616
unique_name: Internet Sales
1717
object_type: model
1818
label: Internet Sales
@@ -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,16 +208,16 @@ 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
215217
Object from
216218
Object to
217219
String role_play
218220
String type
219-
Boolean m2m
220221
}
221222
class From{
222223
String dataset
@@ -238,13 +239,19 @@ namespace Models{
238239
String unique_name
239240
String notes
240241
Array~String~ metrics
241-
Array~AttributeReference~ attributes
242+
Array~AttributeReferenceDrillthrough~ attributes
243+
}
244+
class AttributeReferenceDrillthrough{
245+
String name
246+
String dimension
247+
Array~String~ relationships_path
242248
}
243249
class AttributeReference{
244250
String name
245251
String dimension
246252
String partition
247253
String distribution
254+
Array~String~ relationships_path
248255
}
249256
class Partition{
250257
String unique_name
@@ -266,14 +273,12 @@ namespace Models{
266273
}
267274
class PerspectiveDimension{
268275
String name
269-
Boolean visible
270276
Array~PerspectiveHierarchy~ hierarchies
271-
Array~String~ secondaryattributes
272-
Array~String~ metrics
277+
Array~String~ secondary_attributes
278+
Array~String~ relationships_path
273279
}
274280
class PerspectiveHierarchy{
275281
String name
276-
Boolean visible
277282
Array~String~ levels
278283
}
279284
}
@@ -480,18 +485,18 @@ Supported properties:
480485
- `name`: String, required. The name of the dimension to include in the
481486
perspective.
482487

483-
- `prefixes`: Array, optional.
484-
485488
- `hierarchies`: Array, optional. A list of the specific hierarchies
486489
within the `name` dimension to include in the perspective. Supported
487490
properties:
488-
- `name`: String, required. The name of the hierarchy.
489-
- `levels`: Array, optional. A list of the levels within the
490-
hierarchy to include in the perspective.
491+
- `name`: String, required. The name of the hierarchy.
492+
- `levels`: Array, optional. A list of the levels within the
493+
hierarchy to include in the perspective.
491494

492-
- `secondaryattributes`: Array, optional. A list of the dimension's
495+
- `secondary_attributes`: Array, optional. A list of the dimension's
493496
secondary attributes to include in the perspective.
494497

498+
- `relationships_path`: Array, optional. A list of relationships path.
499+
495500
## drillthroughs
496501

497502
- **Type:** array
@@ -545,6 +550,7 @@ Supported properties:
545550
drillthrough.
546551
- `dimension`: String, optional. The dimension that the attribute
547552
defined by `name` appears in.
553+
- `relationships_path`: Array, optional. A list of relationships path.
548554

549555
## aggregates
550556

@@ -736,3 +742,36 @@ you want to set for it at the model level. For example:
736742

737743
dataset1:
738744
create_hinted_aggregate: true
745+
746+
## overrides
747+
748+
- **Type:** object
749+
- **Required:** N
750+
751+
The `overrides` property in a model file enables the creation of query name overrides for metrics and degenerate dimensions referenced in а model.
752+
This scenario arises from legacy projects where metrics or dimensions in different models can use the same `unique_name` when deployed.
753+
Since project scope uniqueness is enforced these metrics/dimensions are required have a different `unique_name` value in the repo.
754+
When a model is deployed the overridden `unique_name` is replaced by the original value.
755+
The best practice is to never use the same `unique_name` for different objects across models so overrides should only be used when migrating
756+
from a legacy model and wanting to maintain the same query name for existing interfaces.
757+
758+
**Note:** This applies only for degenerate dimensions, NOT the dimensions part of relationships.
759+
760+
- The object key must be a metric or a dimension referenced in the model.
761+
762+
### query_name
763+
764+
- **Type:** string
765+
- **Required:** Y
766+
767+
The query name that the metric or dimension should be resolved to.
768+
769+
Sample `overrides`:
770+
771+
```yaml
772+
overrides:
773+
salesamount:
774+
query_name: deployed query name for metric
775+
Color Dimension:
776+
query_name: deployed query name for dimension
777+
```

0 commit comments

Comments
 (0)