Example representation: Data model with a union
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
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
USA_1910_CURRENTin theEXAMPLES.USA_NAMESschema. -
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 > Union.
-
In the Select source modal, search for the table
USA_1910_CURRENTin theEXAMPLES.USA_NAMESschema. -
Select the table, and click Select to add it to the union.
-
Click
Add source to add another table to the union.
-
In the Select source modal, search for the table element
USA_1910_CURRENTthat you added to the data model in step 5. -
Click Select to add the table element to the union.
-
Click Done.
The union appears in the data model. The union has two sources: the
USA_1910_CURRENTtable from the warehouse and theUSA_1910_CURRENTtable element. It has twice as many rows as theUSA_1910_CURRENTtable. -
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": "e56f0589-0415-41ff-9118-f8ae8372ddce",
"name": "union",
"url": "https://aws-api.sigmacomputing.com/org-name/data-model/union-vuGK4eYzQKo7cwVtaRhfPT",
"documentVersion": 2,
"latestDocumentVersion": 2,
"ownerId": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"folderId": "fcb10706-125c-4a83-83d1-2977c8d963a0",
"createdBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"updatedBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
"createdAt": "2026-01-22T15:14:50.029Z",
"updatedAt": "2026-01-22T18:00:11.232Z",
"schemaVersion": 1,
"pages": [
{
"id": "lUtYrQmeEH",
"name": "Page 1",
"elements": [
{
"id": "8MZYOrmLoJ",
"kind": "table",
"source": {
"connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
"kind": "warehouse-table",
"path": [
"EXAMPLES",
"USA_NAMES",
"USA_1910_CURRENT"
]
},
"columns": [
{
"id": "inode-BzqcKe9CyZaMNcddl8oAV1/STATE",
"formula": "[USA_1910_CURRENT/State]"
},
{
"id": "inode-BzqcKe9CyZaMNcddl8oAV1/GENDER",
"formula": "[USA_1910_CURRENT/Gender]"
},
{
"id": "inode-BzqcKe9CyZaMNcddl8oAV1/YEAR",
"formula": "[USA_1910_CURRENT/Year]"
},
{
"id": "inode-BzqcKe9CyZaMNcddl8oAV1/NAME",
"formula": "[USA_1910_CURRENT/Name]"
},
{
"id": "inode-BzqcKe9CyZaMNcddl8oAV1/NUMBER",
"formula": "[USA_1910_CURRENT/Number]"
}
],
"order": [
"inode-BzqcKe9CyZaMNcddl8oAV1/STATE",
"inode-BzqcKe9CyZaMNcddl8oAV1/GENDER",
"inode-BzqcKe9CyZaMNcddl8oAV1/YEAR",
"inode-BzqcKe9CyZaMNcddl8oAV1/NAME",
"inode-BzqcKe9CyZaMNcddl8oAV1/NUMBER"
]
},
{
"id": "GAxzD7jjC8",
"kind": "table",
"source": {
"kind": "union",
"sources": [
{
"connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
"kind": "warehouse-table",
"path": [
"EXAMPLES",
"USA_NAMES",
"USA_1910_CURRENT"
]
},
{
"elementId": "8MZYOrmLoJ",
"kind": "table"
}
],
"matches": [
{
"outputColumnName": "State",
"sourceColumns": [
"[State]",
"[State]"
]
},
{
"outputColumnName": "Gender",
"sourceColumns": [
"[Gender]",
"[Gender]"
]
},
{
"outputColumnName": "Year",
"sourceColumns": [
"[Year]",
"[Year]"
]
},
{
"outputColumnName": "Name",
"sourceColumns": [
"[Name]",
"[Name]"
]
},
{
"outputColumnName": "Number",
"sourceColumns": [
"[Number]",
"[Number]"
]
}
]
},
"columns": [
{
"id": "Z76M0orFz7",
"formula": "[Union of 2 Sources/State]"
},
{
"id": "YPqzDQNGPA",
"formula": "[Union of 2 Sources/Gender]"
},
{
"id": "pt3aHGGKcX",
"formula": "[Union of 2 Sources/Year]"
},
{
"id": "0Tspn0vuGr",
"formula": "[Union of 2 Sources/Name]"
},
{
"id": "NBLMIxRgh3",
"formula": "[Union of 2 Sources/Number]"
}
],
"order": [
"Z76M0orFz7",
"YPqzDQNGPA",
"pt3aHGGKcX",
"0Tspn0vuGr",
"NBLMIxRgh3"
]
}
]
}
]
}Representing unions
In this representation, the union is represented by this object in the elements array of the data model:
Union representation
...
{
"id": "GAxzD7jjC8",
"kind": "table",
"source": {
"kind": "union",
"sources": [
{
"connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
"kind": "warehouse-table",
"path": [
"EXAMPLES",
"USA_NAMES",
"USA_1910_CURRENT"
]
},
{
"elementId": "8MZYOrmLoJ",
"kind": "table"
}
],
"matches": [
{
"outputColumnName": "State",
"sourceColumns": [
"[State]",
"[State]"
]
},
{
"outputColumnName": "Gender",
"sourceColumns": [
"[Gender]",
"[Gender]"
]
},
{
"outputColumnName": "Year",
"sourceColumns": [
"[Year]",
"[Year]"
]
},
{
"outputColumnName": "Name",
"sourceColumns": [
"[Name]",
"[Name]"
]
},
{
"outputColumnName": "Number",
"sourceColumns": [
"[Number]",
"[Number]"
]
}
]
},
"columns": [
{
"id": "Z76M0orFz7",
"formula": "[Union of 2 Sources/State]"
},
{
"id": "YPqzDQNGPA",
"formula": "[Union of 2 Sources/Gender]"
},
{
"id": "pt3aHGGKcX",
"formula": "[Union of 2 Sources/Year]"
},
{
"id": "0Tspn0vuGr",
"formula": "[Union of 2 Sources/Name]"
},
{
"id": "NBLMIxRgh3",
"formula": "[Union of 2 Sources/Number]"
}
],
"order": [
"Z76M0orFz7",
"YPqzDQNGPA",
"pt3aHGGKcX",
"0Tspn0vuGr",
"NBLMIxRgh3"
]
}
...The matches array defines the columns that are used to match the two sources in the union. Each object in the array has the following properties:
outputColumnName: The name of the column in the union.sourceColumns: An array of the names of the columns in the sources that are matched to create the output column.
Updated about 14 hours ago
