... to my blog style space for easier contribution by third parties and to provide what I believe to be an easier reading experience. Please field all enquiries and issues to the source repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Generate Date Dimension Table for BigQuery - adjust date range as required | |
--this is a modified version of ewhauser/date_dim.sql gist | |
SELECT | |
d as id, | |
FORMAT_DATE('%Y-%m', d) as yearMonth, | |
FORMAT_DATE('%F', d) as yearMonthDay, | |
EXTRACT(YEAR FROM d) AS year, | |
EXTRACT(MONTH FROM d) AS month, | |
FORMAT_DATE('%m', d) as monthPadded, | |
EXTRACT(DAY FROM d) as day, |