A logical view is a queryable object whose fields come from more than one underlying data object, composed inside the Semantic Model rather than stored in a single physical table. Defined as a SemanticLogicalView, it bundles its member data objects and how they combine, then exposes their columns as one flat set of fields. You query a logical view exactly like a plain data object: reference its columns with table_field, using the logical view’s apiName as table_name.
There are four types of logical view, distinguished by how the view composes its members:
Standard — joins its member data objects horizontally on matching keys, using join relationships defined inside the view. This is the default type.
Union — appends the rows of its member objects vertically (a UNION ALL), aligning their columns through mapped fields.
Custom SQL — exposes the output columns of a SQL statement defined in the model.
Organizational hierarchy — derives a transitive parent-child table from a parent-key relationship, so a query can roll values up the hierarchy and scope a result to a subtree.
Whichever type a view is, you never express the composition at query time — no join clauses, no UNION, no raw SQL travel in the request. The composition lives in the model, and a query only names the view’s columns. The single most important thing to know: a logical view is addressed by its own apiName, and its columns carry composite names (<SourceObjectApiName>_<fieldApiName>) that keep same-named fields from different members distinct.
Metadata in the model
A logical view is defined in the Semantic Data Model as a SemanticLogicalView under the model’s semanticLogicalViews. Its type is set by semanticViewTypeEnum: a standard view (the default) carries member data objects and their join relationships; a union view carries a semanticUnions block; a custom SQL view sets semanticViewTypeEnum: "CustomSQL" and carries the SQL in customSQLV2; an organizational hierarchy sets semanticViewTypeEnum: "Hierarchy" and derives a transitive parent-child table. A query references a view’s fields by name; it never redefines the view. For the authoring shape, see Semantic Logical View and Semantic CustomSql Logical View in the Authoring API.
At query time every logical view behaves like any other queryable object: select its columns through table_field (by physical column and table name) or reference model-defined calculated fields over it through semantic_field.
Query usage
Standard logical views
A standard logical view joins its member data objects internally and exposes their columns as one flat set of fields. Each output column is named <SourceObjectApiName>_<fieldApiName> — the member object’s API name and the field’s API name joined by an underscore — which is how two same-named fields from different member objects stay distinct.
Query it exactly like a plain data object: reference a column with table_field, using the logical view’s apiName as table_name. Model-defined calculated fields can read the view’s columns through the same <logicalView>.<column> path, and you select those calcs through semantic_field as usual.
The example below queries a logical view named logicalTable that joins an Account and a Contact data object: it selects two of the view’s columns and a calculated measurement whose expression reads one of them.
Joins inside a logical view are defined by the view itself, with explicit join types, not through the model’s top-level semanticRelationships. To connect a whole logical view to another data object, use a top-level relationship — see Relationships & Joins.
Union logical views
A union logical view appends the rows of several member data objects that share a schema — a vertical combination (UNION ALL), unlike a standard view’s horizontal join. The members live under a semanticUnions block, and their columns are aligned by semanticMappedFields: each mapped field declares a unified column and the member field it draws from in each source object. At query time you select the unified column from the outer view; the engine emits the UNION ALL and returns one row per source record, with a column that a given source object does not map returning NULL.
The example below queries an outerLogicalView whose semanticUnions block unions three member objects. It selects two unified columns, unifiedName and unifiedDate.
Note that unifiedDate maps only SemanticAccount__dlm and SemanticOrder__dlm — it omits SemanticContact__dlm, so rows contributed by the Contact object return NULL for that column.
Custom SQL logical views
A custom SQL logical view is a SemanticLogicalView with semanticViewTypeEnum: "CustomSQL" whose fields are the output columns of a SQL statement defined in the model. The SQL statement lives in the customSQLV2 attribute, and the objects it reads from are declared in referenceIntegritySemanticDataObjects. The output columns of that SQL become the view’s queryable fields.
There is no query-time SQL construct: you never send raw SQL in a request. The SQL lives in the model, and a query references the resulting view’s columns by name exactly as it would any other data object. Reference the logical view’s output fields with table_field, using the logical view’s apiName as the table_name.
Performance: A custom SQL logical view is treated as an opaque subquery. Outer filters and limits are not pushed into it, so the inner statement materializes in full before they apply.
Performance: Selecting fewer columns does not reduce work inside the custom SQL — every column, join, and aggregation in the statement is computed regardless of what the outer query selects.
Performance: For an expensive custom SQL view, consider precomputing it upstream to cut query-time cost.
Organizational hierarchies
An organizational hierarchy — such as a role, manager, or territory hierarchy — is a SemanticLogicalView with semanticViewTypeEnum: "Hierarchy" that derives a transitive parent-child table from an underlying parent-key relationship. It lets a query aggregate values that roll up through parent-child relationships and exposes generated fields such as level and path.
Most of the hierarchy is transparent at query time: you reference the hierarchical view’s fields by name, and the engine performs the recursive walk. The one construct you set directly in a query is the HierarchyScope filter operator, which limits a result to the subtree rooted at a specific node.
Performance: On-the-fly hierarchy resolution uses a recursive traversal whose cost grows with hierarchy depth and node count; consider a persisted hierarchy for large trees.
Query a hierarchy
Reference the hierarchical logical view’s fields — such as the generated level and path fields — by table_field, using the view’s apiName as the table_name. Set row_grouping: true on the fields you want to group by.
Performance: A persisted (materialized) hierarchy is read from a precomputed table instead of being resolved with a recursive traversal at query time, which substantially reduces query cost.
Scope a hierarchy to a subtree
Use the HierarchyScope operator to limit a hierarchy result to the subtree rooted at a specific node. In a flatten_filter (or a model filter), set "operator": "HierarchyScope" with the root node identifier as value, referencing the hierarchy’s parent-key field.
The same scope can be expressed as a structured predicate with the BINARY_OPERATOR_HIERARCHY_SCOPE operator, using a table_field left expression and a string_expression right operand for the root node.
Performance: Scope a hierarchy query to a subtree with HierarchyScope to prune the traversal to the nodes under a chosen root.
Reference
Only the fields introduced on this page are listed. For the full request schema, see Request Reference.
Field (wire name)
Type
Required
Description
semanticLogicalViews
SemanticLogicalView[]
N
Logical views on the model. Each bundles member data objects and how they combine (join, union, or custom SQL) and exposes their columns as one queryable object. Defined at authoring time — see Related.
table_field
TableField
N
References a column of a logical view by name + table_name, where table_name is the logical view’s apiName.
semanticViewTypeEnum
String (enum)
N
The composition type of a logical view. CustomSQL marks a custom SQL view; Hierarchy marks an organizational hierarchy; a standard (join) view is the default.
semanticUnions
SemanticUnion[]
N
On a union logical view, the block that appends member data objects vertically (UNION ALL).
semanticMappedFields
SemanticMappedField[]
N
Within a semanticUnions block, aligns member columns into a unified column; each declares the source field per member object.
customSQLV2
String
N
On a custom SQL view, the SQL statement whose output columns become the view’s fields. Requires semanticViewTypeEnum: "CustomSQL".
referenceIntegritySemanticDataObjects
SemanticDataObject[]
N
On a custom SQL view, the data objects the SQL statement reads from. All tables and fields referenced in the SQL should be listed.
operator ("HierarchyScope")
String (PascalCase)
N
In flatten_filter/model-filter form, limits an organizational-hierarchy result to the subtree rooted at value.
binary_operator (BINARY_OPERATOR_HIERARCHY_SCOPE)
String (enum)
N
Structured-predicate form of the hierarchy-scope operator; the root node is supplied as the right string_expression.
For the relationship fields that define joins inside a standard logical view, see Relationships & Joins and the authoring entity in Related.
Limitations
A logical view exposes composite column names, referenced by the view’s own apiName. Use <SourceObjectApiName>_<fieldApiName> as the column name and the logical view’s apiName as table_name — this is the form the view exposes, distinct from a member object’s original field apiName.
A union spans one logical view only. A union lives inside a logical view, cannot coexist with joins in the same logical view, and only one union is supported per logical view.
Unmapped union columns return NULL. When a union member does not map a given unified column, rows contributed by that member return NULL for it.
Custom SQL logical views have no query-time request construct. You cannot pass raw SQL in a query; the SQL is defined in the model and referenced by field.
The HierarchyScope value is a single root node. It scopes an organizational-hierarchy result to that node’s subtree; pair it with an IsNull condition on the parent-key field to also include entry-level rows.