Skip to main content

Schema


A schema defines the structure of a dataset. It specifies which fields are available, the data types they use, whether values can be empty, and which field or combination of fields uniquely identifies each row.

In DQL, schemas are used to validate queries based on field names and types. They also support autocomplete in the editor, ensure filters and joins are applied correctly, and help route queries to the appropriate backend or data source.

Schema Components

ComponentExplanation
FieldsThese are the names of individual attributes or columns in each data row.
Data typesEvery field has a defined data type such as integer, string, boolean, or float. See full list
NullabilityThis indicates whether a field is allowed to be empty (null). Nullable fields may not always contain a value in every record.
Primary key(s)A primary key is one or more fields that uniquely identify each row of the dataset. DQL uses it to support joins and de-duplicate results.

Table Schema

Represents the full schema of a dataset or table, including its name and column definitions.

{
"name": <string>,
"columns": [
{ Object ( Column ) }
],
"comment": <string>
}

Column Schema

Defines the structure of an individual column, including its name, type, constraints, and generation behavior.

{
"name": <string>,
"arrayDataType": <string>,
"dataType": <string>,
"dataLength": <integer>,
"precision": <integer>,
"scale": <integer>,
"ordinalPosition": <integer>,
"comment": <string>,
"collate": <string>,
"pk": <boolean>,
"unique": <boolean>,
"notNullable": <boolean>,
"generated": { Object ( Expression ) },
"generatedStored": <boolean>,
"generatedVirtual": <boolean>,
"default": { Object ( Expression ) },
"check": { Object ( LogicalExpression ) }
}

Example Dataset Schema

This format defines the fields and types of a dataset. It is used by DQL to validate queries, drive autocomplete, and map datasets to their underlying sources. In this example, only dataType fields are used.

{
"name": "visits_summary",
"columns": [
{
"name": "nb_uniq_visitors",
"dataType": "INTEGER"
},
{
"name": "nb_users",
"dataType": "INTEGER"
},
{
"name": "nb_visits",
"dataType": "INTEGER"
},
{
"name": "nb_actions",
"dataType": "INTEGER"
},
{
"name": "nb_visits_converted",
"dataType": "INTEGER"
},
{
"name": "bounce_count",
"dataType": "INTEGER"
},
{
"name": "sum_visit_length",
"dataType": "INTEGER"
},
{
"name": "max_actions",
"dataType": "INTEGER"
},
{
"name": "bounce_rate",
"dataType": "FLOAT"
},
{
"name": "nb_actions_per_visit",
"dataType": "FLOAT"
},
{
"name": "avg_time_on_site",
"dataType": "FLOAT"
},
{
"name": "date",
"dataType": "DATE"
}
]
}