AML Model
Introduction
A Model in AML represents either a database table or a SQL query, and contains dimensions and measures that define how data can be explored and aggregated. Models are declared in .model.aml files (one model per file).
Model types
AML supports two types of models:
- Table Model: Built on top of a physical database table
- Query Model: Built on top of a custom SQL query
Common parameters
These parameters are shared by both Table Models and Query Models:
| Parameter name | Description |
|---|---|
| type | Model type: 'table' for Table Model, 'query' for Query Model |
| label | User-friendly name for the model that appears in the Dataset exploration UI |
| description | Description of the model. Support Markdown. |
| data_source_name | The database on which Holistics will execute the SQL generated from this model |
| owner | Define who should be in charge of managing the current model |
| dimension | Define a dimension. See Model Fields |
| measure | Define a measure. See Model Fields |
Basic syntax
Model model_name {
type: 'table' // or 'query'
label: "Model Label"
description: "Model description here"
data_source_name: 'your_datasource_name'
dimension dimension_name {
label: 'Dimension Label'
type: 'text'
definition: @sql {{ #SOURCE.column_name }};;
}
measure measure_name {
label: 'Measure Label'
type: 'number'
definition: @aql count(model_name.dimension_name) ;;
}
}