From 9d1f9a77f8479efb9ef421488f1fb2a81c6675d1 Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Wed, 10 Dec 2025 09:43:17 +0000 Subject: [PATCH] [v3-1-test] Fix an odd import of pendulum from sqlalchemy_utils instead of elsewhere. (#59258) This was likely a case of auto-complete gone wrong. Most of the time this doesn't matter (as SQLa etc is already loaded) but this was importing it in Task SDK mistakenly which we don't want. Interestingly mypy now "noticed" that `pendulum.parse` can return Duration, Date, and Time objects too. I don't know why it didn't notice this before. Also generally this isn't the right import :) (cherry picked from commit 0b6d2589df046535b284e032ea8fa5922fab3b6f) Co-authored-by: Ash Berlin-Taylor --- airflow-core/src/airflow/dag_processing/bundles/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airflow-core/src/airflow/dag_processing/bundles/base.py b/airflow-core/src/airflow/dag_processing/bundles/base.py index 1ab14abd047fb..2df62bcf2b8f8 100644 --- a/airflow-core/src/airflow/dag_processing/bundles/base.py +++ b/airflow-core/src/airflow/dag_processing/bundles/base.py @@ -32,8 +32,8 @@ from pathlib import Path from typing import TYPE_CHECKING +import pendulum from pendulum.parsing import ParserError -from sqlalchemy_utils.types.enriched_datetime.pendulum_datetime import pendulum from airflow.configuration import conf @@ -98,7 +98,8 @@ class BundleUsageTrackingManager: def _parse_dt(self, val) -> DateTime | None: try: - return pendulum.parse(val) + dt = pendulum.parse(val) + return dt if isinstance(dt, pendulum.DateTime) else None except ParserError: return None