Table Model
Knowledge Checkpoint
A grasp of these concepts will help you understand this documentation better:
Introduction
Table Model defines a data model that sits on top of a SQL table.
Parameter definition
| 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 |
| table_name | Path to the table underlying this model, in the form: '"schema_name"."table_name"' |
| dimension | Define a dimension. |
| measure | Define a measure. |
Code Example
Model users {
type: 'table'
label: "Users"
data_source_name: 'bigquery_dw'
table_name: 'users'
dimension id {
label: 'ID'
type: 'number'
primary_key: true // recommended for query optimization and AQL features
hidden: false // optional
definition: @sql {{#SOURCE.id}};; // optional
}
dimension email {
label: 'Email'
type: 'text'
// without "definition", it automatically uses the same column name as the dimension name ('email')
}
measure user_count {
type: 'number'
label: 'Count Users'
definition: @sql count({{#SOURCE.id}});;
}
}