Skip to main content

Overview

Entities represent distinct objects or concepts in your data model (like customers, orders, or products). They enable automatic relationship discovery and intelligent joins between views. When you define entities consistently across views, the semantic model automatically understands relationships and can join data seamlessly.

Entity Types

Primary Entity

Each view should have exactly one primary entity representing the main subject:

Foreign Entity

Foreign entities reference objects primarily defined in other views:

Entity Properties

*Note: Either key or keys must be provided, but not both.
Important: Entity Keys Reference Dimension NamesThe key and keys fields must reference dimension names, not database column names.For example, if your dimension is defined as:
Your entity key should reference the dimension name:
This naming convention is critical because Oxygen uses entity keys to:
  1. Mark dimensions as primary keys in the semantic schema
  2. Automatically generate join relationships between views

Simple Entity Keys

Use the key property for entities with a single identifier:
Now queries can seamlessly join these views:
  • “Show total revenue by customer acquisition channel”
  • “What’s the average order value for customers from email campaigns?”

Composite Keys

For entities with composite keys, use the keys field:
The semantic model will automatically join these views on both order_id and line_item_id.

How Entities Enable Joins

When you define entities consistently across views, Oxygen automatically:
  1. Identifies relationships between views based on matching entity names
  2. Generates JOIN clauses using the entity keys
  3. Enables cross-view queries without manual join logic

Example: Multi-View Query

Given these view definitions:
Users can ask questions that span all these views:
  • “What’s the total revenue by product category?” (joins orders, order_items, products)
  • “Show me customer lifetime value by acquisition channel” (joins customers, orders)
  • “Which products have the highest return rates?” (joins products, order_items, orders)

Best Practices

Naming

  • Use singular nouns (e.g., customer, order, product)
  • Use consistent names across all views
  • Match the business terminology your organization uses

Design

  • Each view should have exactly one primary entity
  • Add foreign entities for all relationships to other views
  • Ensure entity keys reference valid dimensions in the view

Performance

  • Index the columns used as entity keys in your database
  • For composite keys, create composite indexes on those columns
  • Consider the cardinality of joins when designing entities

Common Patterns

One-to-Many Relationships

Many-to-Many Relationships

Hierarchical Relationships

Views

Learn about creating views

Dimensions

Define dimensions for your entities

Overview

Back to semantic model overview