Skip to main content

Overview

Views represent logical data models that define how to access and interpret data. They encapsulate the business logic needed to transform raw tables into meaningful business concepts. A view defines:
  • How to access data (table or custom SQL)
  • What entities exist in the data
  • Available dimensions (attributes)
  • Available measures (metrics and aggregations)

Basic View Structure

Create a file with the .view.yml extension in your semantics/views/ directory:
semantics/views/orders.view.yml

View Properties

SQL-Based Views

For complex transformations, use custom SQL instead of a direct table reference:
semantics/views/customer_metrics.view.yml

Best Practices

Naming

  • Use lowercase, descriptive names (e.g., orders, customer_metrics)
  • Keep names concise but clear
  • Avoid technical prefixes like tbl_ or view_

Structure

  • Keep views focused on a single primary entity
  • Use foreign entities to establish relationships between views
  • Organize related views in the same directory

Performance

  • Use table references when possible instead of complex SQL
  • Pre-aggregate data in SQL-based views when appropriate
  • Index the key columns referenced in entity definitions

Documentation

  • Always provide clear descriptions
  • Include sample values for important dimensions
  • Document any business rules or calculations

Entities

Define entities and relationships

Dimensions

Add dimensions to your views

Measures

Define measures and metrics

Overview

Back to semantic model overview