Nifi init
This commit is contained in:
18
nifi/sql/extract/01_dim_date.sql
Normal file
18
nifi/sql/extract/01_dim_date.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Generates one row per calendar date covering the full EWC 2025 event window.
|
||||
-- Run on MySQL source DB.
|
||||
WITH RECURSIVE dates AS (
|
||||
SELECT DATE('2025-07-08') AS d
|
||||
UNION ALL
|
||||
SELECT DATE_ADD(d, INTERVAL 1 DAY) FROM dates WHERE d < '2025-08-24'
|
||||
)
|
||||
SELECT
|
||||
CAST(DATE_FORMAT(d, '%Y%m%d') AS UNSIGNED) AS date_key,
|
||||
d AS full_date,
|
||||
YEAR(d) AS year,
|
||||
QUARTER(d) AS quarter,
|
||||
MONTH(d) AS month,
|
||||
MONTHNAME(d) AS month_name,
|
||||
WEEK(d, 1) AS week_number,
|
||||
DAYOFMONTH(d) AS day_of_month,
|
||||
DAYNAME(d) AS day_name
|
||||
FROM dates;
|
||||
Reference in New Issue
Block a user