Semantic Model JSON specification¶
This page documents the JSON structure of a semantic model and its versions, as created and edited through the Semantic Model editor described in Create, import and manage Semantic Models. It is a reference for the full field-level structure, useful when reasoning about a version’s content beyond what the editor UI surfaces directly.
Global structure¶
A semantic model is a container for one or more versions, one of which is designated as active.
Most of a semantic model’s content – entities, relationships, golden queries, glossary, and settings – lives inside a version, not at the top level.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Unique identifier of the semantic model |
|
string |
Yes |
Key of the project the semantic model belongs to |
|
string |
Yes |
Name of the semantic model |
|
string |
No |
Description of the semantic model |
|
string |
No |
Short description of the semantic model |
|
string |
No |
|
|
array |
No |
The semantic model’s versions – see Versions |
|
– |
No |
Standard Dataiku object metadata, common to other DSS objects |
Example:
{
"id": "sm_id_1",
"projectKey": "SALES_ANALYTICS",
"name": "Sales Semantic Model",
"description": "Sales analytics semantic layer",
"shortDesc": "Sales semantic layer",
"activeVersionId": "v1",
"tags": [],
"customFields": {},
"checklists": {},
"versionTag": {},
"creationTag": {},
"versions": []
}
Versions¶
A version holds the full definition of a semantic model at a point in time: its entities, their relationships, and the settings used to generate SQL from natural language questions.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Unique identifier of the version |
|
string |
No |
Description of the version |
|
object |
No |
|
|
array |
No |
The version’s entities – see Entities |
|
array |
No |
Joins between entities – see Relationships |
|
array |
No |
See Golden queries |
|
array |
No |
|
|
array |
No |
See Glossary |
|
array |
No |
See Glossary |
|
object |
No |
|
|
object |
No |
|
|
object |
No |
Example:
{
"id": "v1",
"description": "Initial version",
"created": {
"on": "2026-05-27T12:00:00Z",
"by": "[email protected]"
},
"entities": [],
"relationships": [],
"goldenQueries": [],
"crossEntityMetrics": [],
"glossaryTerms": [],
"glossaryBindings": [],
"indexingSettings": {},
"sqlGenerationConfig": {},
"privateEditorData": {}
}
Entities¶
An entity maps to a dataset in the project. It groups the attributes, metrics and filters built on top of that dataset.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the entity |
|
string |
No |
Description of the entity |
|
array of strings |
No |
Tags for the entity |
|
string |
No |
Entity source type; currently always |
|
string |
No |
The underlying dataset: its name for a dataset in the same project, or |
|
array |
No |
See Attributes |
|
array |
No |
Entity-level metrics – see Metrics |
|
array |
No |
See Filters |
|
object |
No |
|
|
array |
No |
Example:
{
"name": "orders",
"description": "Customer orders with revenue and status fields",
"tags": [],
"type": "DATASET",
"datasetRef": "SALES_ANALYTICS.orders",
"attributes": [],
"metrics": [],
"filters": [],
"primaryKey": {
"attributes": ["order_id"]
},
"foreignKeys": []
}
Attributes¶
Attributes map to columns of the entity’s dataset, or to expressions computed from them.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the attribute |
|
string |
No |
Description of the attribute |
|
string |
No |
DSS type of the underlying column or expression (e.g. |
|
string |
No |
|
|
string |
No |
Source column name, for |
|
string |
No |
SQL expression, for |
|
string |
No |
|
|
array of strings |
No |
Sample values, used when |
|
boolean |
No |
Whether to index distinct values |
|
boolean |
No |
Whether the attribute is resolvable: included in term resolution to fuzzy-match user query terms |
|
string |
No |
LLM instructions for this attribute |
|
object |
No |
Attribute-level SQL generation config. Supports |
distinctValuesHandlingMode determines where an attribute’s sample values come from: NONE tracks none, MANUAL uses the values listed in manualValues, and AUTO_INDEX fetches them automatically during indexing (see Create, import and manage Semantic Models).
Examples:
A COLUMN attribute with manually entered sample values:
{
"name": "order_status",
"description": "Current lifecycle status of the order",
"dssType": "string",
"type": "COLUMN",
"column": "status",
"distinctValuesHandlingMode": "MANUAL",
"manualValues": ["pending", "shipped", "cancelled"],
"indexDistinctValues": true,
"resolveInUserRequests": true,
"llmInstructions": "Use for order status questions.",
"sqlGenerationConfig": {}
}
An EXPRESSION attribute, not resolvable:
{
"name": "order_month",
"description": "Calendar month of the order date",
"dssType": "date",
"type": "EXPRESSION",
"pseudoSQLExpression": "DATE_TRUNC('month', order_date)",
"distinctValuesHandlingMode": "NONE",
"manualValues": [],
"indexDistinctValues": false,
"resolveInUserRequests": false,
"sqlGenerationConfig": {}
}
A COLUMN attribute with automatically indexed sample values:
{
"name": "region",
"description": "Sales region of the order",
"dssType": "string",
"type": "COLUMN",
"column": "region",
"distinctValuesHandlingMode": "AUTO_INDEX",
"manualValues": [],
"indexDistinctValues": true,
"resolveInUserRequests": true,
"sqlGenerationConfig": {
"autoValuesLimit": 100
}
}
Metrics¶
Entity-level metrics are aggregations of the entity’s attributes.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the metric |
|
string |
No |
Description of the metric |
|
string |
Yes |
Aggregation expression (e.g. |
|
string |
No |
LLM instructions for this metric |
|
object |
No |
Example:
{
"name": "total_revenue",
"description": "Total revenue from all orders",
"pseudoSQLExpression": "SUM(order_amount)",
"llmInstructions": "Use when the user asks for sales or revenue totals.",
"created": {
"on": "2026-05-27T12:15:00Z",
"by": "[email protected]"
}
}
Filters¶
Filters are named, reusable WHERE clause fragments defined on an entity.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the filter |
|
string |
No |
Description of the filter |
|
string |
Yes |
|
|
string |
No |
LLM instructions for this filter |
|
object |
No |
Example:
{
"name": "completed_orders",
"description": "Orders that have been shipped to customers",
"pseudoSQLExpression": "status = 'shipped'",
"llmInstructions": "Apply for completed or fulfilled orders.",
"created": {
"on": "2026-05-27T12:20:00Z",
"by": "[email protected]"
}
}
Primary and foreign keys¶
primaryKey lists the attribute(s) that uniquely identify a row of the entity. foreignKeys lists other entities this entity’s attributes point to; joins actually used for SQL generation are expressed at the version level, in Relationships.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
array of strings |
No |
Names of the attributes making up the primary key |
|
string |
Yes |
Name of the referenced entity |
|
array of strings |
No |
Names of the attributes making up the key |
Example:
{
"primaryKey": {
"attributes": ["order_id"]
},
"foreignKeys": [
{
"referencedEntity": "customers",
"key": {
"attributes": ["customer_id"]
}
}
]
}
Relationships¶
Relationships are the version-level joins between two entities, described in Create, import and manage Semantic Models.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Name of the relationship |
|
string |
No |
Description of the relationship |
|
string |
Yes |
Name of the first entity |
|
string |
Yes |
Name of the second entity |
|
string |
No |
Join hint (e.g. |
Example:
{
"name": "orders_to_customers",
"description": "Each order belongs to one customer",
"firstEntity": "orders",
"secondEntity": "customers",
"pseudoSQLExpression": "orders.customer_id = customers.customer_id"
}
Golden queries¶
Golden queries are pre-recorded questions and their expected SQL, described in Create, import and manage Semantic Models.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the golden query |
|
string |
No |
Description of the golden query |
|
string |
Yes |
Natural language question |
|
string |
Yes |
Expected SQL query |
|
object |
No |
Example:
{
"name": "monthly_revenue_emea",
"description": "Monthly EMEA revenue for the last 6 months",
"question": "What was monthly revenue in EMEA for the last 6 months?",
"generatedSql": "SELECT DATE_TRUNC('month', order_date) AS month, SUM(order_amount) AS revenue FROM orders WHERE region = 'EMEA' AND order_date >= DATEADD(month, -6, CURRENT_DATE) GROUP BY 1 ORDER BY 1",
"created": {
"on": "2026-05-27T12:45:00Z",
"by": "[email protected]"
}
}
Cross-entity metrics¶
Cross-entity metrics are metrics that can combine attributes from more than one entity, described in Create, import and manage Semantic Models.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Name of the metric |
|
string |
Yes |
Description of the metric |
|
string |
Yes |
Aggregation expression, which can reference attributes from several entities |
|
string |
Yes |
LLM instructions for this metric |
Unlike entity-level metrics, description and llmInstructions are required for cross-entity metrics.
Example:
{
"name": "average_order_value",
"description": "Average revenue per order",
"pseudoSQLExpression": "SUM(orders.order_amount) / COUNT(DISTINCT orders.order_id)",
"llmInstructions": "Prefer when the user asks for AOV or average basket size."
}
Glossary¶
The glossary is a collection of business terms, optionally bound to entities, attributes, metrics or filters, described in Create, import and manage Semantic Models.
Glossary terms¶
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Unique identifier of the term |
|
string |
Yes |
The term or phrase |
|
string |
No |
Explanation of the term |
|
string |
Yes |
|
|
boolean |
No |
Whether the term was edited by a user after creation |
|
array of strings |
No |
Alternative terms |
|
object |
No |
|
|
object |
No |
|
|
object |
No |
Editor-internal data for this term |
Example:
{
"id": "9f5dfb35-2d8c-4f11-b94d-7a6f95d2b302",
"term": "AOV",
"description": "Average order value, calculated as total revenue divided by number of orders",
"source": "MANUAL",
"userModified": true,
"synonyms": ["average basket size", "avg order value"],
"created": {
"on": "2026-05-27T12:50:00Z",
"by": "[email protected]"
},
"privateEditorData": {}
}
Glossary bindings¶
A binding links a glossary term to an entity, or to a specific attribute, metric or filter of that entity.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
|
|
string |
Yes |
Name of the target entity |
|
string |
Yes |
|
|
string |
No |
Name of the target attribute, metric or filter; |
|
object |
No |
Examples:
A term bound to an attribute:
{
"termId": "9f5dfb35-2d8c-4f11-b94d-7a6f95d2b302",
"targetEntityClass": "orders",
"targetType": "ATTRIBUTE",
"targetName": "order_amount",
"created": {
"on": "2026-05-28T09:12:00Z",
"by": "[email protected]"
}
}
A term bound to an entire entity, with no targetName:
{
"termId": "9f5dfb35-2d8c-4f11-b94d-7a6f95d2b302",
"targetEntityClass": "orders",
"targetType": "ENTITY_CLASS",
"targetName": null,
"created": {
"on": "2026-05-28T09:12:00Z",
"by": "[email protected]"
}
}
Indexing settings¶
Row and value sampling limits applied by the indexing process described in Create, import and manage Semantic Models.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
integer |
|
Maximum number of distinct values retained per attribute |
|
integer |
|
Maximum rows scanned for SQL datasets; |
|
integer |
|
Maximum rows scanned for non-SQL datasets |
Example:
{
"maxDistinctValuesPerAttribute": 1000,
"maxScannedRowsForSQLDatasets": -1,
"maxScannedRowsForNonSQLDatasets": 1000000
}
SQL generation config¶
Version-level configuration for SQL generation, matching the settings of the Semantic Model Query Tool when it is used from the Playground.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Model-level LLM instructions, set in the Instructions tab |
|
array of strings |
No |
|
|
integer |
No |
Maximum rows the LLM has access to from a query’s results |
|
integer |
No |
Maximum rows displayed in sources |
|
integer |
No |
Maximum rows included in artifacts |
|
integer |
No |
Maximum agent recursion depth, when Agent mode is enabled |
Example:
{
"instructions": "When comparing periods, aggregate by calendar month and use the order_date field unless the user specifies otherwise.",
"vocabularyTermIds": ["9f5dfb35-2d8c-4f11-b94d-7a6f95d2b302"],
"maxRowsPerQuery": 1000,
"agentRecursionLimit": 25
}
Private editor data¶
Version-level state used by the Semantic Model editor.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
LLM used for SQL generation in the Playground |
|
string |
No |
Embedding LLM used for semantic value matching |
|
boolean |
No |
Whether to use the agentic SQL generation workflow |
Example:
{
"llmId": "openai:gpt-4o",
"embeddingLlmId": "openai:text-embedding-3-small",
"agentMode": true
}