Skip to main content
The core declaration of the field definition. Best practice dictates using field references over raw database columns when calling other fields/dimensions. Note that dimensions can only derived from other dimensions, unlike measures.
DO NOT PARSE is a special argument used to stop Omni’s parser from interpreting and validating the SQL. This should be used in the rare circumstance that Omni is not saving valid SQL in the model, which can happen when obscure, dialect-specific SQL is used.

Syntax

<dimension_name>:
  sql: <sql_expression>
DO NOT PARSE usage
<dimension_name>:
  sql: |-
    -- DO NOT PARSE
    <sql_expression>

Properties

dimension_name
object
The name of the dimension. Dimension names must:
  • Be unique within the view
  • Start with a letter
  • Contain only alphanumeric characters and underscores

Examples

Concatenated fields
full_name:
  sql: CONCAT(${users.first_name}, ' ', ${users.last_name})
Calculated margin
margin:
  sql: ${order_items.sale_price} - ${products.cost}
Case statement
is_special_date:
  sql: |-
    CASE
      WHEN ${orders.created_at[date]} >= '2022-04-14' AND ${orders.created_at[date]} <= '2022-05-09'
      THEN 'Mothers Day 2022'
      WHEN ${orders.created_at[date]} >= '2022-05-26' AND ${orders.created_at[date]} <= '2022-06-20'
      THEN 'Fathers Day 2022'
      ELSE 'Other'
    END
DO NOT PARSE usage
state_sentiment:
  sql: |-
    -- DO NOT PARSE
    SNOWFLAKE.CORTEX.SENTIMENT(${states.state})::float
Type casting
zip_code_string:
  sql: ${zip_code}::string