Documentation Index
Fetch the complete documentation index at: https://oxy.tech/docs/llms.txt
Use this file to discover all available pages before exploring further.
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
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique identifier for the view |
description | string | Yes | Human-readable description of what this view represents |
datasource | string | Yes | Name of the datasource to use |
table | string | Conditional | Database table reference (required if sql not specified) |
sql | string | Conditional | Custom SQL query (required if table not specified) |
entities | array | Yes | List of entities in this view |
dimensions | array | Yes | List of dimensions (attributes) |
measures | array | No | List of measures (aggregations) |
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_orview_
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
Related Documentation
Entities
Define entities and relationships
Dimensions
Add dimensions to your views
Measures
Define measures and metrics
Overview
Back to semantic layer overview