Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from packaging.version import Version

from airflow.exceptions import AirflowConfigException, AirflowException
from airflow.providers.apache.beam.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook
from airflow.providers.common.compat.standard.utils import prepare_virtualenv

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@
from airflow.exceptions import AirflowException, AirflowOptionalProviderFeatureException
from airflow.providers.apache.beam.hooks.beam import BeamHook, BeamRunnerType
from airflow.providers.apache.beam.triggers.beam import BeamJavaPipelineTrigger, BeamPythonPipelineTrigger
from airflow.providers.apache.beam.version_compat import BaseOperator
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers_manager import ProvidersManager
from airflow.utils.helpers import convert_camel_to_snake, exactly_one
from airflow.version import version

if TYPE_CHECKING:
from airflow.utils.context import Context

from airflow.providers.common.compat.sdk import Context
GOOGLE_PROVIDER = ProvidersManager().providers.get("apache-airflow-providers-google")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:

AIRFLOW_V_3_1_PLUS = get_base_airflow_version_tuple() >= (3, 1, 0)

if AIRFLOW_V_3_1_PLUS:
from airflow.sdk import BaseHook, BaseOperator
else:
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
from airflow.models import BaseOperator

__all__ = [
"AIRFLOW_V_3_1_PLUS",
"BaseHook",
"BaseOperator",
]
8 changes: 8 additions & 0 deletions providers/apache/cassandra/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,19 @@ dependencies = [
"cassandra-driver>=3.29.1",
]

# The optional dependencies should be modified in place in the generated file
# Any change in the dependencies is preserved when the file is regenerated
[project.optional-dependencies]
"common.compat" = [
"apache-airflow-providers-common-compat"
]

[dependency-groups]
dev = [
"apache-airflow",
"apache-airflow-task-sdk",
"apache-airflow-devel-common",
"apache-airflow-providers-common-compat",
# Additional devel dependencies (do not remove this line and add extra development dependencies)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
WhiteListRoundRobinPolicy,
)

from airflow.providers.apache.cassandra.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook
from airflow.utils.log.logging_mixin import LoggingMixin

Policy: TypeAlias = DCAwareRoundRobinPolicy | RoundRobinPolicy | TokenAwarePolicy | WhiteListRoundRobinPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from typing import TYPE_CHECKING, Any

from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook
from airflow.providers.apache.cassandra.version_compat import BaseSensorOperator
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class CassandraRecordSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from typing import TYPE_CHECKING, Any

from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook
from airflow.providers.apache.cassandra.version_compat import BaseSensorOperator
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class CassandraTableSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)


if AIRFLOW_V_3_1_PLUS:
from airflow.sdk import BaseHook
else:
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk import BaseSensorOperator
else:
from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]

__all__ = [
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_1_PLUS",
"BaseHook",
"BaseSensorOperator",
]
8 changes: 8 additions & 0 deletions providers/apache/flink/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ dependencies = [
"apache-airflow-providers-cncf-kubernetes>=5.1.0",
]

# The optional dependencies should be modified in place in the generated file
# Any change in the dependencies is preserved when the file is regenerated
[project.optional-dependencies]
"common.compat" = [
"apache-airflow-providers-common-compat"
]

[dependency-groups]
dev = [
"apache-airflow",
"apache-airflow-task-sdk",
"apache-airflow-devel-common",
"apache-airflow-providers-cncf-kubernetes",
"apache-airflow-providers-common-compat",
# Additional devel dependencies (do not remove this line and add extra development dependencies)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
from functools import cached_property
from typing import TYPE_CHECKING

from airflow.providers.apache.flink.version_compat import BaseOperator
from airflow.providers.cncf.kubernetes.hooks.kubernetes import KubernetesHook
from airflow.providers.common.compat.sdk import BaseOperator

if TYPE_CHECKING:
from kubernetes.client import CoreV1Api

from airflow.providers.apache.flink.version_compat import Context
from airflow.providers.common.compat.sdk import Context


class FlinkKubernetesOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
from kubernetes import client

from airflow.exceptions import AirflowException
from airflow.providers.apache.flink.version_compat import BaseSensorOperator
from airflow.providers.cncf.kubernetes.hooks.kubernetes import KubernetesHook
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.providers.apache.flink.version_compat import Context
from airflow.providers.common.compat.sdk import Context


class FlinkKubernetesSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:

AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk import BaseOperator, BaseSensorOperator
from airflow.sdk.definitions.context import Context
else:
from airflow.models import BaseOperator
from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]
from airflow.utils.context import Context

__all__ = [
"AIRFLOW_V_3_0_PLUS",
"BaseOperator",
"BaseSensorOperator",
"Context",
]
8 changes: 8 additions & 0 deletions providers/apache/hdfs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,19 @@ dependencies = [
'pandas>=2.2.3; python_version >="3.13"',
]

# The optional dependencies should be modified in place in the generated file
# Any change in the dependencies is preserved when the file is regenerated
[project.optional-dependencies]
"common.compat" = [
"apache-airflow-providers-common-compat"
]

[dependency-groups]
dev = [
"apache-airflow",
"apache-airflow-task-sdk",
"apache-airflow-devel-common",
"apache-airflow-providers-common-compat",
# Additional devel dependencies (do not remove this line and add extra development dependencies)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from airflow.configuration import conf
from airflow.exceptions import AirflowException
from airflow.providers.apache.hdfs.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook

log = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any

from airflow.providers.apache.hdfs.version_compat import BaseSensorOperator
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from hdfs import InsecureClient
from hdfs.ext.kerberos import KerberosClient

from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class WebHdfsSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)

if AIRFLOW_V_3_1_PLUS:
from airflow.sdk import BaseHook
else:
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk import BaseSensorOperator
else:
from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]


__all__ = [
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_1_PLUS",
"BaseHook",
"BaseSensorOperator",
]
2 changes: 2 additions & 0 deletions providers/apache/hive/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ requires-python = ">=3.10"
# After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build``
dependencies = [
"apache-airflow>=2.10.0",
"apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version
"apache-airflow-providers-common-sql>=1.26.0",
"hmsclient>=0.1.0",
'pandas>=2.1.2; python_version <"3.13"',
Expand Down Expand Up @@ -98,6 +99,7 @@ dev = [
"apache-airflow-task-sdk",
"apache-airflow-devel-common",
"apache-airflow-providers-amazon",
"apache-airflow-providers-common-compat",
"apache-airflow-providers-common-sql",
"apache-airflow-providers-microsoft-mssql",
"apache-airflow-providers-mysql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from airflow.configuration import conf
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
from airflow.providers.apache.hive.version_compat import (
from airflow.providers.common.compat.sdk import (
AIRFLOW_VAR_NAME_FORMAT_MAPPING,
BaseHook,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

from airflow.configuration import conf
from airflow.providers.apache.hive.hooks.hive import HiveCliHook
from airflow.providers.apache.hive.version_compat import (
from airflow.providers.common.compat.sdk import (
AIRFLOW_VAR_NAME_FORMAT_MAPPING,
BaseOperator,
context_to_airflow_vars,
)

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class HiveOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

from airflow.exceptions import AirflowException
from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook
from airflow.providers.apache.hive.version_compat import BaseOperator
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.mysql.hooks.mysql import MySqlHook
from airflow.providers.presto.hooks.presto import PrestoHook

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class HiveStatsCollectionOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from typing import TYPE_CHECKING, Any

from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook
from airflow.providers.apache.hive.version_compat import BaseSensorOperator
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class HivePartitionSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from airflow.providers.common.sql.sensors.sql import SqlSensor

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class MetastorePartitionSensor(SqlSensor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any

from airflow.providers.apache.hive.version_compat import BaseSensorOperator
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class NamedHivePartitionSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
from typing import TYPE_CHECKING

from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
from airflow.providers.apache.hive.version_compat import BaseOperator, context_to_airflow_vars
from airflow.providers.common.compat.sdk import BaseOperator, context_to_airflow_vars
from airflow.providers.mysql.hooks.mysql import MySqlHook

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class HiveToMySqlOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
from typing import TYPE_CHECKING

from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
from airflow.providers.apache.hive.version_compat import BaseOperator, context_to_airflow_vars
from airflow.providers.common.compat.sdk import BaseOperator, context_to_airflow_vars
from airflow.providers.samba.hooks.samba import SambaHook

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class HiveToSambaOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import pymssql

from airflow.providers.apache.hive.hooks.hive import HiveCliHook
from airflow.providers.apache.hive.version_compat import BaseOperator
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class MsSqlToHiveOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@


from airflow.providers.apache.hive.hooks.hive import HiveCliHook
from airflow.providers.apache.hive.version_compat import BaseOperator
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.mysql.hooks.mysql import MySqlHook

if TYPE_CHECKING:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class MySqlToHiveOperator(BaseOperator):
Expand Down
Loading