Skip to content
Last updated

Create an Insights Model

Call #POST /reporting/datamodels to create a data model. The following is an example that creates a data model while referencing the previously created YAML file.

  • Access sample_datasets database and create two tables: nasdaq and www_access.
  • Create a relationship between the symbol column and the host column.

For the API endpoint, select the appropriate endpoint for your region.

curl -X POST --data-urlencode "yaml=$(cat datamodel.yml)" \
-H 'Authorization: TD1 xxxx/xxxxxxxxxxxxxx' \
https://${TD_API_ENDPOINT}/reporting/datamodels  

The actual Insights model is created in the analytics platform; the prefix created uses the following format: dm_{your account id}_.__ For example,__ if your account id is 1, the Insights model name is dm_1_sample_datamodel.

Model names are case insensitive; the model name automatically converts to lower case. For example, data_MODEL_one and data_model_ONE create the same data model: data_model_one.

The Analytics platform does not support unixtimestamp. If you want to use datetime in a widget, convert unixtimestamp to text with the timestamp format before you create an Insights model and define the column as a type of timestamp.