How do I make a primary key for my dimension group (timestamp, date)?

Knowledge Drop

Last tested: May 11, 2020
 

Since a dimension group is a collection of dimensions, you can't make it a primary key. Instead, make a single dimension with one timeframe, and let that be your primary key.

So if you have:

dimension_group: created {

type: time

timeframes: [time, month, year]

sql: ${TABLE}.created_at ;;

}

Then you can add a new dimension:

dimension: created_pk {

type: string

hidden: yes

primary_key: yes

sql: ${created_time} ;;

}

Here we add hidden because created_time is already in the dimension group.

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 03:34 PM
Updated by: