- Definition. Views can be based on a database table, a workbook query, or raw SQL.
- Fields, which are the modeled objects that enable self-service querying.
- Metadata, such as access grants, its UI visibility, or AI context
Views versus topics
A view is a single object in your data model, whereas topics sit on top of the data model and reshape it into business-friendly groupings for easier exploration. Topics can include multiple views, which can be curated ahead of time for self-service. Think of views as the objects that make up topics, and topics as the presentation layer you tailor for quick insights. Topics effectively translate your database model into reusable logic for building dashboards and workbooks.Accessing view files
In the model IDE, views are nested under the database schema that contains them. You can use the search or click through the Schemas section of the model IDE to locate individual views.Creating views
To add a new view, click File > New view in the model IDE. Omni will prompt you to enter a name and then create a new view file. Refer to the View parameter reference to learn more about how configuring views.To reference fields in the view where they’re defined, use
{$field} rather than {$view.field}. Using ${field} ensures that the reference will remain even if the you alias the view, whereas ${view.field} will cause a model validation error because it doesn’t pick up the alias.Aliasing views
When a table name changes
When a table name changes
If the name of view’s base table changes in the database, it can cause content in Omni to break. Use the
aliases parameter to add the table’s original name(s), which will allow Omni to find the correct table in the databse.When you need duplicate views
When you need duplicate views
In some cases, you may need to duplicate a view - for example, a
users view that contains both buyers and sellers. Aliased views are automatically created when you define them as joins in the model’s Relationships file.The following example demonstrates how to alias the users view to create buyers and sellers views. Note that the names of the aliased views are used to declare the joins:relationships.yaml