sunank200 commented on code in PR #43902: URL: https://github.com/apache/airflow/pull/43902#discussion_r1843227287
########## providers/src/airflow/providers/presto/hooks/presto.py: ########## @@ -22,32 +22,38 @@ from typing import TYPE_CHECKING, Any, Iterable, Mapping, TypeVar import prestodb +from packaging.version import Version from prestodb.exceptions import DatabaseError from prestodb.transaction import IsolationLevel +from airflow import __version__ as airflow_version from airflow.configuration import conf from airflow.exceptions import AirflowException from airflow.providers.common.sql.hooks.sql import DbApiHook from airflow.utils.operator_helpers import AIRFLOW_VAR_NAME_FORMAT_MAPPING, DEFAULT_FORMAT_PREFIX +AIRFLOW_VERSION = Version(airflow_version) +AIRFLOW_V_3_0_PLUS = Version(AIRFLOW_VERSION.base_version) >= Version("3.0.0") + if TYPE_CHECKING: from airflow.models import Connection T = TypeVar("T") def generate_presto_client_info() -> str: - """Return json string with dag_id, task_id, execution_date and try_number.""" + """Return json string with dag_id, task_id, logical_date and try_number.""" context_var = { format_map["default"].replace(DEFAULT_FORMAT_PREFIX, ""): os.environ.get( format_map["env_var_format"], "" ) for format_map in AIRFLOW_VAR_NAME_FORMAT_MAPPING.values() } + date_key = "logical_date" if AIRFLOW_V_3_0_PLUS else "execution_date" task_info = { "dag_id": context_var["dag_id"], "task_id": context_var["task_id"], - "execution_date": context_var["execution_date"], + date_key: context_var["logical_date"] if AIRFLOW_V_3_0_PLUS else context_var["execution_date"], Review Comment: I had changed this but it was failing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org