{{ config( materialized='table', engine='MergeTree', order_by='(date_id_str, full_time_str, time_id)' ) }} Select toYYYYMMDDhhmmss(`full_time`) As time_id , `full_time` , `date_id` , hour(`full_time`) As `hour` , minute(`full_time`) As `minute` , formatDateTimeInJodaSyntax(`full_time`, 'yyyy-MM-dd HH:mm:ss') As full_time_str , Cast(`date_id` As String) As date_id_str From( SELECT arrayJoin( arrayMap( x -> toStartOfMinute(toDateTime(toDate(`full_date`)) + x * 60), range(0, 24 * 60) ) ) AS `full_time` , `date_id` From {{ ref("dw.dim_date") }} Where `date_id` >= 20090101 ) As T