amoghrajesh commented on code in PR #47644:
URL: https://github.com/apache/airflow/pull/47644#discussion_r2006979425
##########
providers/apache/hive/src/airflow/providers/apache/hive/transfers/hive_to_mysql.py:
##########
@@ -25,8 +25,14 @@
from airflow.models import BaseOperator
from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
+from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.providers.mysql.hooks.mysql import MySqlHook
-from airflow.utils.operator_helpers import context_to_airflow_vars
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import context_to_airflow_vars
+else:
+ from airflow.utils.operator_helpers import context_to_airflow_vars #
type: ignore[no-redef, attr-defined]
Review Comment:
Same comment here as above
##########
providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py:
##########
@@ -35,10 +35,17 @@
from airflow.configuration import conf
from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
+from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.security import utils
from airflow.utils.helpers import as_flattened_list
-from airflow.utils.operator_helpers import AIRFLOW_VAR_NAME_FORMAT_MAPPING
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import
AIRFLOW_VAR_NAME_FORMAT_MAPPING
+else:
+ from airflow.utils.operator_helpers import ( # type: ignore[no-redef,
attr-defined]
+ AIRFLOW_VAR_NAME_FORMAT_MAPPING,
+ )
Review Comment:
```suggestion
from airflow.utils.operator_helpers import
AIRFLOW_VAR_NAME_FORMAT_MAPPING # type: ignore[no-redef]
```
Only no-redef not enough?
##########
providers/standard/src/airflow/providers/standard/operators/bash.py:
##########
@@ -27,10 +27,15 @@
from airflow.exceptions import AirflowException, AirflowSkipException
from airflow.models.baseoperator import BaseOperator
from airflow.providers.standard.hooks.subprocess import SubprocessHook,
SubprocessResult, working_directory
-from airflow.utils.operator_helpers import context_to_airflow_vars
+from airflow.providers.standard.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.types import ArgNotSet
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import context_to_airflow_vars
+else:
+ from airflow.utils.operator_helpers import context_to_airflow_vars #
type: ignore[no-redef, attr-defined]
Review Comment:
Same comment as above
##########
providers/apache/hive/tests/unit/apache/hive/hooks/test_hive.py:
##########
@@ -30,9 +30,9 @@
from airflow.models.connection import Connection
from airflow.models.dag import DAG
from airflow.providers.apache.hive.hooks.hive import HiveCliHook,
HiveMetastoreHook, HiveServer2Hook
+from airflow.sdk.execution_time.context import AIRFLOW_VAR_NAME_FORMAT_MAPPING
Review Comment:
Now this will need an AF3 check
##########
providers/apache/hive/src/airflow/providers/apache/hive/transfers/hive_to_samba.py:
##########
@@ -25,8 +25,13 @@
from airflow.models import BaseOperator
from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
+from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.providers.samba.hooks.samba import SambaHook
-from airflow.utils.operator_helpers import context_to_airflow_vars
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import context_to_airflow_vars
+else:
+ from airflow.utils.operator_helpers import context_to_airflow_vars #
type: ignore[no-redef, attr-defined]
Review Comment:
Same comment here as above
##########
generated/provider_dependencies.json:
##########
@@ -178,6 +178,7 @@
],
"cross-providers-deps": [
"amazon",
+ "common.compat",
Review Comment:
This will go away once you remove the AF3 check in core
##########
providers/trino/src/airflow/providers/trino/hooks/trino.py:
##########
@@ -32,7 +32,14 @@
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.trino.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.utils.helpers import exactly_one
-from airflow.utils.operator_helpers import AIRFLOW_VAR_NAME_FORMAT_MAPPING,
DEFAULT_FORMAT_PREFIX
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import
AIRFLOW_VAR_NAME_FORMAT_MAPPING, DEFAULT_FORMAT_PREFIX
+else:
+ from airflow.utils.operator_helpers import ( # type: ignore[no-redef,
attr-defined]
Review Comment:
Same comment as above
##########
providers/apache/hive/src/airflow/providers/apache/hive/operators/hive.py:
##########
@@ -26,8 +26,15 @@
from airflow.configuration import conf
from airflow.models import BaseOperator
from airflow.providers.apache.hive.hooks.hive import HiveCliHook
-from airflow.utils import operator_helpers
-from airflow.utils.operator_helpers import context_to_airflow_vars
+from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import
AIRFLOW_VAR_NAME_FORMAT_MAPPING, context_to_airflow_vars
+else:
+ from airflow.utils.operator_helpers import ( # type: ignore[no-redef,
attr-defined]
Review Comment:
Same comment here as above
##########
providers/presto/src/airflow/providers/presto/hooks/presto.py:
##########
@@ -30,7 +30,14 @@
from airflow.exceptions import AirflowException
from airflow.providers.common.sql.hooks.sql import DbApiHook
from airflow.providers.presto.version_compat import AIRFLOW_V_3_0_PLUS
-from airflow.utils.operator_helpers import AIRFLOW_VAR_NAME_FORMAT_MAPPING,
DEFAULT_FORMAT_PREFIX
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk.execution_time.context import
AIRFLOW_VAR_NAME_FORMAT_MAPPING, DEFAULT_FORMAT_PREFIX
+else:
+ from airflow.utils.operator_helpers import ( # type: ignore[no-redef,
attr-defined]
Review Comment:
Same comment about only no-redef here
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]