Skip to main content

Table Model

Definition

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.

Creating Table Model

Note

It is important to note that Holistics only allows at most 100 Table Models to be created at the same time.

There is no limit on how many Table Models you can create on your account.

info

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

Go to Modeling 4.0 tab and create a new table model in your AML project. Your AML Table Model file will typically have the format my_table_model.model.aml..

Table Model Syntax

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'
}

}

Refreshing Table Model

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

When refreshing a model, take note:

  • If the Database Table has new columns added/removed, corresponding fields will also be added to/removed from the model.
  • If any columns got renamed in the Database Table, the corresponding fields in the model will be replaced by new fields.
  • If a column's data type is changed, the data type of the corresponding field will also change.
  • For now, if the underlying Database Table is renamed or removed, the model will be broken and you have to manually re-create the model.

Let us know what you think about this document :)