From 6306006f824c404c136d859c9136843562dc8766 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 11 Jan 2026 15:55:41 +0100 Subject: [PATCH] Fix: Update RAWDATACOR partition end_year and mapping logic - Fix get_partitions_from_year(): RAWDATACOR end_year now 2030 (was 2024) - RAWDATACOR has partitions d12-d17 for years 2025-2030, not just part0-part10 - Update year_to_partition_name() for RAWDATACOR: handle both part and d suffix - Years 2014-2024: use "part" suffix with formula (year - 2014) - Years 2025-2030: use "d" suffix with formula (year - 2013) for d12-d17 - Clamp year to range [2014, 2030] for RAWDATACOR - Update docstring examples to reflect new mapping behavior - Now correctly generates partitions like: part8, part9, part10, d12, d13, ..., d17 Co-Authored-By: Claude Haiku 4.5 --- config.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index 3bb75a4..1f5c37b 100644 --- a/config.py +++ b/config.py @@ -211,13 +211,22 @@ def year_to_partition_name(year: int, table: str) -> str: if table_upper == "RAWDATACOR": # RAWDATACOR: 2014-2024 (part0-part10) + # RAWDATACOR: 2025-2030 (d12-d17) + if year < 2014: year = 2014 - elif year > 2024: - year = 2024 + elif year > 2030: + year = 2030 + + if year < 2025: + suffix = "part" + d_year = 2014 + else: + suffix = "d" + d_year = 2013 # Continue naming as d12, d13, ... - partition_index = year - 2014 # 2014→0, 2015→1, ..., 2024→10 - return f"part{partition_index}" + partition_index = year - d_year # 2014→0, 2015→1, ..., 2024→10 - 2025→12, ..., 2030→17 + return f"{suffix}{partition_index}" elif table_upper == "ELABDATADISP": # ELABDATADISP: 2013-2031 (d0-d18) @@ -245,16 +254,16 @@ def get_partitions_from_year(year: int, table: str) -> list[str]: Example: get_partitions_from_year(2022, "RAWDATACOR") - → ["part8", "part9", "part10"] # 2022→8, 2023→9, 2024→10 (stop at latest) + → ["part8", "part9", "part10", "d12", "d13", "d14", "d15", "d16", "d17"] # 2022→part8, ..., 2024→part10, 2025→d12, ..., 2030→d17 get_partitions_from_year(2025, "ELABDATADISP") - → ["d12", "d13", "d14", "d15", "d16", "d17", "d18"] # 2025-2031 + → ["d12", "d13", "d14", "d15", "d16", "d17"] # 2025-2030 """ table_upper = table.upper() partitions = [] if table_upper == "RAWDATACOR": - end_year = 2024 # RAWDATACOR: part0-part10 (2014-2024) + end_year = 2030 # RAWDATACOR: part0-part10 (2014-2024) + d12-d17 (2025-2030) elif table_upper == "ELABDATADISP": end_year = 2030 # ELABDATADISP: d0-d17 (2013-2030) else: