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
11 changes: 6 additions & 5 deletions dev/breeze/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ def test_get_min_airflow_version(provider_id: str, min_version: str):

def test_convert_cross_package_dependencies_to_table():
EXPECTED = """
| Dependent package | Extra |
|:------------------------------------------------------------------------------------|:--------------|
| [apache-airflow-providers-common-sql](https://airflow.apache.org/docs/common-sql) | `common.sql` |
| [apache-airflow-providers-google](https://airflow.apache.org/docs/google) | `google` |
| [apache-airflow-providers-openlineage](https://airflow.apache.org/docs/openlineage) | `openlineage` |
| Dependent package | Extra |
|:----------------------------------------------------------------------------------------|:----------------|
| [apache-airflow-providers-common-compat](https://airflow.apache.org/docs/common-compat) | `common.compat` |
| [apache-airflow-providers-common-sql](https://airflow.apache.org/docs/common-sql) | `common.sql` |
| [apache-airflow-providers-google](https://airflow.apache.org/docs/google) | `google` |
| [apache-airflow-providers-openlineage](https://airflow.apache.org/docs/openlineage) | `openlineage` |
"""
assert (
convert_cross_package_dependencies_to_table(get_cross_provider_dependent_packages("trino")).strip()
Expand Down
4 changes: 2 additions & 2 deletions dev/breeze/tests/test_provider_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_get_downstream_only():
related_providers = get_related_providers(
"trino", upstream_dependencies=False, downstream_dependencies=True
)
assert {"openlineage", "google", "common.sql"} == related_providers
assert {"openlineage", "google", "common.sql", "common.compat"} == related_providers


def test_get_upstream_only():
Expand All @@ -41,7 +41,7 @@ def test_both():
related_providers = get_related_providers(
"trino", upstream_dependencies=True, downstream_dependencies=True
)
assert {"openlineage", "google", "mysql", "common.sql"} == related_providers
assert {"openlineage", "google", "mysql", "common.sql", "common.compat"} == related_providers


def test_none():
Expand Down
2 changes: 2 additions & 0 deletions providers/tableau/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
"tableauserverclient>=0.27",
]

Expand All @@ -66,6 +67,7 @@ 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 @@ -24,7 +24,7 @@
from tableauserverclient import JWTAuth, Pager, Server, TableauAuth

from airflow.exceptions import AirflowException
from airflow.providers.tableau.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook
from airflow.utils.helpers import exactly_one

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@
from typing import TYPE_CHECKING

from airflow.exceptions import AirflowException
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.tableau.hooks.tableau import (
TableauHook,
TableauJobFailedException,
TableauJobFinishCode,
)
from airflow.providers.tableau.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context

RESOURCES_METHODS = {
"datasources": ["delete", "refresh"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

from airflow.providers.common.compat.sdk import BaseSensorOperator
from airflow.providers.tableau.hooks.tableau import (
TableauHook,
TableauJobFailedException,
TableauJobFinishCode,
)
from airflow.providers.tableau.version_compat import BaseSensorOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class TableauJobStatusSensor(BaseSensorOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,4 @@ 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 BaseOperator, BaseSensorOperator
else:
from airflow.models import BaseOperator
from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]

__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "BaseOperator", "BaseSensorOperator"]
__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS"]
2 changes: 2 additions & 0 deletions providers/telegram/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
"python-telegram-bot>=20.2",
]

Expand All @@ -66,6 +67,7 @@ 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 @@
import tenacity

from airflow.exceptions import AirflowException
from airflow.providers.telegram.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook


class TelegramHook(BaseHook):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@
from typing import TYPE_CHECKING

from airflow.exceptions import AirflowException
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.telegram.hooks.telegram import TelegramHook
from airflow.providers.telegram.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class TelegramOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,4 @@ 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 BaseOperator
else:
from airflow.models import BaseOperator

__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "BaseOperator"]
__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS"]
2 changes: 2 additions & 0 deletions providers/teradata/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.20.0",
"teradatasqlalchemy>=17.20.0.0",
"teradatasql>=17.20.0.28",
Expand All @@ -82,6 +83,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-azure",
"apache-airflow-providers-ssh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from typing import Any

from airflow.exceptions import AirflowException
from airflow.providers.teradata.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook


class TtuHook(BaseHook, ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@
if TYPE_CHECKING:
from paramiko import SSHClient

try:
from airflow.sdk.definitions.context import Context
except ImportError:
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.ssh.hooks.ssh import SSHHook
from airflow.providers.teradata.hooks.bteq import BteqHook
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator


def contains_template(parameter_value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING, ClassVar

from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class TeradataOperator(SQLExecuteQueryOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@
from functools import cached_property
from typing import TYPE_CHECKING

from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.utils.constants import Constants
from airflow.providers.teradata.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context

from collections.abc import Sequence
from datetime import timedelta
Expand All @@ -41,11 +37,7 @@
from airflow.providers.teradata.triggers.teradata_compute_cluster import TeradataComputeClusterSyncTrigger

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context

from airflow.exceptions import AirflowException

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

raise AirflowOptionalProviderFeatureException(e)

from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator

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


class AzureBlobStorageToTeradataOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@
from airflow.exceptions import AirflowOptionalProviderFeatureException

raise AirflowOptionalProviderFeatureException(e)
from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class S3ToTeradataOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@
from functools import cached_property
from typing import TYPE_CHECKING

from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class TeradataToTeradataOperator(BaseOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,4 @@ 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 BaseOperator
else:
from airflow.models import BaseOperator

__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "BaseOperator"]
__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS"]
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_remote_execution_with_sql(
mock_execute_bteq_script.assert_called_once()
assert result == 0

@mock.patch("airflow.providers.teradata.version_compat.BaseOperator.render_template")
@mock.patch("airflow.providers.common.compat.sdk.BaseOperator.render_template")
def test_render_template_in_sql(self, mock_render):
op = BteqOperator(task_id="render_test", sql="SELECT * FROM {{ params.table }};")
mock_render.return_value = "SELECT * FROM my_table;"
Expand Down
2 changes: 2 additions & 0 deletions providers/trino/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.20.0",
'pandas>=2.1.2; python_version <"3.13"',
'pandas>=2.2.3; python_version >="3.13"',
Expand All @@ -79,6 +80,7 @@ dev = [
"apache-airflow",
"apache-airflow-task-sdk",
"apache-airflow-devel-common",
"apache-airflow-providers-common-compat",
"apache-airflow-providers-common-sql",
"apache-airflow-providers-google",
"apache-airflow-providers-openlineage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING

from airflow.providers.common.compat.sdk import BaseOperator
from airflow.providers.google.cloud.hooks.gcs import GCSHook
from airflow.providers.trino.hooks.trino import TrinoHook
from airflow.providers.trino.version_compat import BaseOperator

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class GCSToTrinoOperator(BaseOperator):
Expand Down
6 changes: 0 additions & 6 deletions providers/trino/src/airflow/providers/trino/version_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +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
else:
from airflow.models import BaseOperator

__all__ = [
"AIRFLOW_V_3_0_PLUS",
"BaseOperator",
]
Loading