Skip to main content

Create a dataset

Important

The GraphQL Insights API is currently in Early Availability status for customers on the AWS-US cluster. For more information, see GraphQL API policy.

A dataset is like a table in a relational database. To create a dataset, you must define the attributes it contains by specifying the name, category, and datatype of each attribute.

The category of each attribute may be DIMENSION or MEASURE:

  • A DIMENSION generally represents the name of a category or individual item you want to use to filter your results, and is most often a STRING datatype.
  • A MEASURE is usually represents an amount or other numerical result that you want to aggregate and analyze, and is usually an INT or other numerical datatype.

For example, in the table below:

RegionCountryMonthNew contracts
AmericasUSAJanuary1145
AmericasCanadaJanuary134
EuropeUKJanuary735
EuropeFranceJanuary726

Region, Country, and Month could each be a DIMENSION, and New contracts could be a MEASURE.

The attributes in your dataset are for you to define, based on the information you have available about your product on your own platform.

Mutation

mutation createVisualizationDataset($in: CreateVisualizationDatasetInput!) {
createVisualizationDataset(input: $in) {
dataset {
id
revisionId
}
userErrors {
message
path
}
}
}

Variables

{
"in": {
"name": "QuickStartTestDataset",
"productId": "12345a6b-c7d8-90e1-2f3g-45678h90i123",
"datasetSchema": [
{
"name": "my_product_dimension_a",
"category": "DIMENSION",
"dataType": {
"name": "STRING"
},
"description": "Dimension A"
},
{
"name": "my_product_measure_b",
"category": "MEASURE",
"dataType": {
"name": "INTEGER"
},
"description": "Measure B"
}
],
"timeColumn": "my_product_time"
}
}

Response

The id returned in this response is the dataset UUID, and is needed for other API calls involving this dataset.

{
"data": {
"createVisualizationDataset": {
"dataset": {
"id": "996e42eb-97b4-4d80-8201-6f377c31e745",
"revisionId": 1
}
}
}
}

Was this page helpful?