Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
Cube.create_date_hierarchy(name, *, column, levels=frozendict({‘Year’: ‘y’, ‘Month’: ‘M’, ‘Day’: ‘d’}))
Create a multilevel date hierarchy based on a date column. The new levels are created by matching a date pattern. Here is a non-exhaustive list of patterns that can be used:| Pattern | Description | Type | Examples |
|---|---|---|---|
| y | Year | Integer | 2001, 2005, 2020 |
| yyyy | 4-digits year | String | "2001", "2005", "2020" |
| M | Month of the year (1 based) | Integer | 1, 5, 12 |
| MM | 2-digits month | String | "01", "05", "12" |
| d | Day of the month | Integer | 1, 15, 30 |
| dd | 2-digits day of the month | String | "01", "15", "30" |
| w | Week number | Integer | 1, 12, 51 |
| Q | Quarter | Integer | 1, 2, 3, 4 |
| QQQ | Quarter prefixed with Q | String | "Q1", "Q2", "Q3", "Q4" |
| H | Hour of day (0-23) | Integer | 0, 12, 23 |
| HH | 2-digits hour of day | String | "00", "12", "23" |
| m | Minute of hour | Integer | 0, 30, 59 |
| mm | 2-digits minute of hour | String | "00", "30", "59" |
| s | Second of minute | Integer | 0, 5, 55 |
| ss | 2-digits second of minute | String | "00", "05", "55" |
- Parameters:
- name (str) – The name of the hierarchy to create.
- column (Column) – The column to create the hierarchy from.
Its
data_typemust beLocalDate,LocalDateTime, orZonedDateTime, and it must belong to an in-memory table, not anexternal one. - levels (Mapping [str , str ]) – The mapping from the names of the levels to the patterns from which they will be created.
- Return type: None