User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
Français
Deutsch
日本語
primary_key

Usage

view: view_name {
  dimension: field_name {
    primary_key: yes
  }
}

Hierarchy

primary_key

Possible Field Types

Dimension

Accepts

A Boolean (yes or no)

Definition

The primary_key parameter specifies that a dimension is the primary key for its view. The default value is false. For example:

dimension: id { primary_key: yes sql: ${TABLE}.id ;; }

The primary_key parameter:

If you have a primary key that is comprised of multiple columns, you can create a dimension that concatenates those columns, then declare that as your primary key. For example:

dimension: primary_key { primary_key: yes sql: CONCAT(${TABLE}.promotion_id, ${TABLE}.sku) ;; }

Please note that a dimension_group cannot be used as a primary key if it specifies more than one timeframe.

Top