Skip to main content
This is useful for ensuring that symmetric aggregates are computed correctly, especially for nested columns (structs) which are common in Google BigQuery.

Syntax

<dimension_name>:
  custom_primary_key_sql_for_quick_aggs: ${<field_reference>}

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

Nested column with custom primary key
dimensions:
  order_id:
    primary_key: true
  order_items: {}
  order_item_price:
    parent_field: order_items
    nested_on_field: order_items
    custom_primary_key_sql_for_quick_aggs: ${order_item_id}
    sql: price

measures:
  total_price:
    sql: ${order_item_price}
    aggregate_type: sum_distinct_on
    custom_primary_key_sql: ${order_item_id}