Big Query supports partitioning a time-unit column based on daily, hourly, monthly or yearly granularity. However, I would like to partition based on half-yearly granularity which is not directly supported.
I am thinking of using the below query, to partition by half yearly granularity. This will put dates from 2016 to 2024 into the respective half yearly partitions.
CREATE TABLE <TABLE_NAME>
PARTITION BY RANGE_BUCKET(DATE_MONTH, GENERATE_ARRAY(0, 108, 6))
AS SELECT *, date_diff(DATE, date '2016-01-01', month) AS DATE_MONTH
FROM <SOURCE_TABLE>
Is the above a reasonable approach, are there any other suggestions or alternatives that can be used to achieve this. I do not like the idea of creating the DATE_MONTH column solely for the sake of partitioning.