Skip to main content

Table Model

Introduction

Table Model is a data model created directly from an existing database table. This is like an abstract representation of your underlying table which you can easily manipulate, annotate, add custom dimensions and measures. With Table Models, you can extend on the original data without affecting the physical table.

The goal of creating table models is to make an existing SQL table available in the Holistics modeling layer.

Create a Table Model

To create a new table model, go to the AML Studio, click on the + symbol next to a folder, and select Add Table Model. A new screen will appear, and from here you can choose the table to create a model from.

After selecting one table (or several tables), new .model.aml files representing the model will be created.

Note

There is no limit on how many Table Models you can create on your account. However, you can only create at most 100 Table Models in one selection.

Table Model Syntax

Below is a sample of how the Table Model syntax will look like. All of these codes will be generated when you create the model using the graphical UI, but you can also create the table model manually by writing from scratch:

Model model_name {
type: 'table'
label: "Model Label"
description: ""
owner: '[email protected]'
data_source_name: 'data_source_name'

table_name: '"schema"."table_name"'

dimension dimension_name_1 {
// dimension 1 definition
label: 'Dimension Label 1'
type: 'text | number | date | datetime | truefalse'
description: 'Field Description'
hidden: true|false
definition: @sql {{#SOURCE.column_name}};;
}

dimension dimension_name_2 {
// dimension 2 definition
}

measure measure_name_1 {
// measure 1 definition
label: 'Measure Name 1'
type: 'number | date | datetime'
definition: @sql {{#SOURCE.column_name}};;
aggregation_type: 'count | count_distinct | sum | avg'
}

}
info

Please refer to AML Table Model Reference to learn more about all available parameters and their example usage.

Sync schema changes from database table

If there are any changes in the schema of the underlying table (columns are deleted, renamed, or added...), you can select Refresh Model to reflect the changes.

For more information about this feature, please refer to our Sync schema changes from database table document.


Let us know what you think about this document :)