- Through the virtualized schema model
- Directly using raw SQL. When using raw SQL, Omni will not generate or override any SQL logic.
Key concepts
Semantic model
Semantic model
Think of a semantic model as instructions to Omni on how to write SQL on your behalf. Omni breaks down common SQL statements you might write into small, reusable pieces that can be pieced together on demand.You donβt have to run everything through a semantic model in Omni - and likely shouldnβt! - but it can be a powerful tool for enabling self-service reporting, AI querying, and improved change management through your BI tool.
Views
Views
View files in Omni are virtualized representations of tables (or views) within your data warehouse that tell Omni how fields in the workbook map to fields in your data warehouse.These map to the
FROM and JOIN statements in SQL.Relationships
Relationships
Relationships tell Omni the join logic that should be used when the multiple views are used in the same analysis.This maps to a
JOIN statement in SQL.Dimensions
Dimensions
Dimensions are field definitions, which can be either a column reference or a calculated field (e.g.
datediffs or case whens). Dimensions are attributes that can be queried and grouped by.These go into SELECT and GROUP BY statements in SQL.Measures
Measures
Measures are field definitions specifically for aggregations -
sums, counts, averages, etc.These go into the SELECT statement in SQL, but wonβt be grouped by.Topics
Topics
Topics are not required for using Omniβs semantic model but they are a helpful tool for adding an extra layer of curation on top of your semantic model.They let you explicitly control how the UI looks and feels to users and have more control over whatβs allowed to be queried for specific contexts. This is especially helpful if they are less familiar with the data warehouse (e.g. tables, schemas, column names, etc.). For example, you may want to curate which fields, tables, and joins are allowed to be used together or perhaps there is a field calculation that has different logic based on the context that itβs getting queried with. Topics will also enable you to manage row-level security, force default behaviors (filters, joins, etc.), and overwrite model and relationship logic if necessary.In the context of SQL, topics can be curated to influence all elements of generated SQL.
Inspecting query SQL
A great way to learn what Omni is doing is to see the SQL generated when you build a query. You can view the generated SQL by opening a workbook. For every query, Omni generates two layers of SQL:SQL wrapped in Omni helper functions
This layer contains Omniβs accelerator functions and is optimized for cache performance and readability. You can inspect this SQL by clicking the SQL button in a workbook query tab:
In this example, the SQL looks like this:
SQL with Omni helper functions
Dialect SQL executed against the database
This layer of SQL is written in the same dialect used by the database backing the connection in Omni. All field references and Omni functions will be translated to the flavor of SQL used by your database. In fact, you could copy this SQL query and run it in another IDE pointed at the database. You can view the dialect SQL by toggling the Inspector on in a workbook query tab:
In this example, the SQL looks like this:
Dialect SQL