Example representation: Data model with a table and relationship
This is an example representation of a data model, created using the get a data model representation endpoint. Representations like this one can be used to create a data model from code using the create a data model from a representation endpoint. Each page in this example library includes the code representation of the data model and step-by-step instructions to create it in the Sigma UI.
Consult this example and others in the Data model representation example library to:
- Troubleshoot the formatting of a particular feature in code representation
- Relate a feature from the Sigma UI to its representation in code
- Provide context to AI tools used to create data models from code
This example representation cannot be used as-is. All identifying details, such as IDs, names, and URLs, have been replaced with randomized ID values or generic substitutions. The format of these contents, like the length of ID values, is preserved for demonstrative purposes. However, this representation cannot be directly used without modification to the base URL, connection details, and more. For more information, see Create and manage data models from code.
System and user requirements
To complete the steps in this example, you must meet the user requirements listed below for creating the data model in the UI and creating it from code.
The ability to create this data model in the Sigma UI requires the following:
- You must be assigned an account type with the Create, edit, and publish data models permissions enabled.
- You must have access to a connection to a data platform.
The ability to create a data model from code requires the following:
- You must be assigned the Admin account type.
- You must have developer credentials for the Sigma API. For more information, see Get started with the Sigma REST API.
This example uses a table from the Sigma Sample Connection. Your organization might have disabled access to the Sigma sample connection. If so, you can contact an admin to enable it, or use a table from another connection to follow along with this example.
Create the example data model in the Sigma UI
This example shows a simple data model with a two table elements, sourced from warehouse tables, with a relationship defined between them.
To create this data model in the Sigma UI:
-
Go to the Home page.
-
Select
Create New > Data model.
A new data model opens.
-
From the Add element bar, select Data > Table.
-
In the Select source modal, search for the table
TIPSin theFUN.BIKESschema. -
Select the table to add it to the data model.
The table appears in the data model.
-
From the Add element bar, select Data > Table.
-
In the Select source modal, search for the table
STATIONSin theFUN.BIKESschema. -
Select the table to add it to the data model.
The table appears in the data model.
-
Select the
TRIPStable. -
In the editor panel, select Modeling.
-
In the Relationships section, select
Add relationship.
-
In the Add a relationship modal, enter the following information:
Field Value Name Trips to Start StationsPrimary source TRIPSTarget source STATIONSJoin keys Start Station Id=Id -
Click Save.
-
Select the caret (
) in the workbook header to open the document menu, then select File > Rename.
-
Rename the data model to
Bikes - Relationship. -
Select Publish.
Get a JSON representation of this data model
To get a JSON representation of this data model, follow the steps in Get the code representation of a data model.
The JSON representation of this data model appears like the following:
JSON representation
{
"dataModelId": "534029c4-7fb4-40e1-997f-7df316ba21d1",
"name": "relationship",
"url": "https://aws-api.sigmacomputing.com/org-name/data-model/relationship-WBjE1GDboFNoVB47aMOWLZ",
"documentVersion": 3,
"latestDocumentVersion": 3,
"ownerId": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"folderId": "fcb10706-125c-4a83-83d1-2977c8d963a0",
"createdBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"updatedBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"createdAt": "2025-11-21T21:10:46.662Z",
"updatedAt": "2026-01-22T17:59:20.355Z",
"schemaVersion": 1,
"pages": [
{
"id": "1G52Gb9yUJ",
"name": "Page 1",
"elements": [
{
"id": "H6faRw6lnp",
"kind": "table",
"source": {
"connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
"kind": "warehouse-table",
"path": [
"FUN",
"BIKES",
"TRIP"
]
},
"columns": [
{
"id": "inode-Z257vm992UGQT5RfsctJgX/ID",
"formula": "[TRIP/Id]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/DURATION",
"formula": "[TRIP/Duration]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/START_DATE",
"formula": "[TRIP/Start Date]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/START_STATION_NAME",
"formula": "[TRIP/Start Station Name]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/START_STATION_ID",
"formula": "[TRIP/Start Station Id]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/END_DATE",
"formula": "[TRIP/End Date]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/END_STATION_NAME",
"formula": "[TRIP/End Station Name]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/END_STATION_ID",
"formula": "[TRIP/End Station Id]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/BIKE_ID",
"formula": "[TRIP/Bike Id]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/SUBSCRIPTION_TYPE",
"formula": "[TRIP/Subscription Type]"
},
{
"id": "inode-Z257vm992UGQT5RfsctJgX/ZIP_CODE",
"formula": "[TRIP/Zip Code]"
}
],
"relationships": [
{
"id": "vHxhzVFQFG",
"targetElementId": "vkClpfG84L",
"keys": [
{
"sourceColumnId": "inode-Z257vm992UGQT5RfsctJgX/START_STATION_ID",
"targetColumnId": "inode-rPvXEuSbIyID9WgpL52Pux/ID"
}
],
"name": "Trips to Start Stations"
}
],
"order": [
"inode-Z257vm992UGQT5RfsctJgX/ID",
"inode-Z257vm992UGQT5RfsctJgX/DURATION",
"inode-Z257vm992UGQT5RfsctJgX/START_DATE",
"inode-Z257vm992UGQT5RfsctJgX/START_STATION_NAME",
"inode-Z257vm992UGQT5RfsctJgX/START_STATION_ID",
"inode-Z257vm992UGQT5RfsctJgX/END_DATE",
"inode-Z257vm992UGQT5RfsctJgX/END_STATION_NAME",
"inode-Z257vm992UGQT5RfsctJgX/END_STATION_ID",
"inode-Z257vm992UGQT5RfsctJgX/BIKE_ID",
"inode-Z257vm992UGQT5RfsctJgX/SUBSCRIPTION_TYPE",
"inode-Z257vm992UGQT5RfsctJgX/ZIP_CODE"
]
},
{
"id": "vkClpfG84L",
"kind": "table",
"source": {
"connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
"kind": "warehouse-table",
"path": [
"FUN",
"BIKES",
"STATIONS"
]
},
"columns": [
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/ID",
"formula": "[STATIONS/Id]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/NAME",
"formula": "[STATIONS/Name]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/LAT",
"formula": "[STATIONS/Lat]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/LONG",
"formula": "[STATIONS/Long]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/DOCK_COUNT",
"formula": "[STATIONS/Dock Count]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/CITY",
"formula": "[STATIONS/City]"
},
{
"id": "inode-rPvXEuSbIyID9WgpL52Pux/INSTALLATION_DATE",
"formula": "[STATIONS/Installation Date]"
}
],
"order": [
"inode-rPvXEuSbIyID9WgpL52Pux/ID",
"inode-rPvXEuSbIyID9WgpL52Pux/NAME",
"inode-rPvXEuSbIyID9WgpL52Pux/LAT",
"inode-rPvXEuSbIyID9WgpL52Pux/LONG",
"inode-rPvXEuSbIyID9WgpL52Pux/DOCK_COUNT",
"inode-rPvXEuSbIyID9WgpL52Pux/CITY",
"inode-rPvXEuSbIyID9WgpL52Pux/INSTALLATION_DATE"
]
}
]
}
]
}Representing relationships
In the representation above, the relationship created in steps 11-13 is represented by an object in the relationships array of the table element:
Relationship representation
...
[
{
"id": "vHxhzVFQFG",
"targetElementId": "vkClpfG84L",
"keys": [
{
"sourceColumnId": "inode-Z257vm992UGQT5RfsctJgX/START_STATION_ID",
"targetColumnId": "inode-rPvXEuSbIyID9WgpL52Pux/ID"
}
],
"name": "Trips to Start Stations"
}
]
...Here, the following properties are defined for the relationship:
id: The unique identifier of the relationship.targetElementId: The ID of the target element in the data model.keys: An array of objects that define the join keys for the relationship. Each object in the array has the following properties:sourceColumnId: The ID of the column in the source element.targetColumnId: The ID of the column in the target element.
name: The name of the relationship.
Updated about 14 hours ago
