沈楠
b4603d5909
Some checks failed
MJN/finance-dbt/pipeline/head There was a failure building this commit
24 lines
516 B
SQL
24 lines
516 B
SQL
{{
|
|
config(
|
|
materialized='table',
|
|
engine='MergeTree',
|
|
order_by='time_id'
|
|
)
|
|
}}
|
|
Select cast(formatDateTime(`full_time`, '%Y%m%d%H%i') As Int64) As time_id
|
|
, `full_time`
|
|
, `date_id`
|
|
, hour(`full_time`) As `hour`
|
|
, minute(`full_time`) As `minute`
|
|
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 |