Skip to content
Last updated

Create an Insights Model Dataset

When you create or add a dataset to an Insights model, consider the following:

  • Definition. Define the definition to have the same schema defined in the YAML file that was used to create the Insights model (POST /reporting/datamodels).
  • Database/table names. Specify the database and table names, and their column information including: “type(required, currently only “presto” is available)”, indexed (optional, default value: false).
  • Dataset name. There are no restrictions on what you name the dataset. Treasure Data recommends that you use the same name as the database.

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

    curl -X POST https://${api endpoint}/reporting/datamodels/xxxxxx/datasets \
    -H 'authorization: TD1 xxxx/xxxxxxxxxxxxxx' \
    -H 'cache-control: no-cache' \
    -H 'accept: application/json' \
    -H 'content-type: application/json' \
    -d '{
      "name": "new_table",
      "definition": {
        "type": "presto",
        "database": "new_db",
        "tables": {
          "new_table": {
            "columns": {
              "id": {
                "type": "text",
                "indexed": true
              }
            }
          }
        }
      }
    }'