Skip to content

Commit 52dd46d

Browse files
authored
Migrate remaining providers to common.compat compatibility layer (apache#57093)
1 parent 8bfd7f1 commit 52dd46d

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

providers/qdrant/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ requires-python = ">=3.10"
5858
# After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build``
5959
dependencies = [
6060
"apache-airflow>=2.10.0",
61+
"apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version
6162
"qdrant_client>=1.15.1",
6263
]
6364

@@ -66,6 +67,7 @@ dev = [
6667
"apache-airflow",
6768
"apache-airflow-task-sdk",
6869
"apache-airflow-devel-common",
70+
"apache-airflow-providers-common-compat",
6971
# Additional devel dependencies (do not remove this line and add extra development dependencies)
7072
]
7173

providers/qdrant/src/airflow/providers/qdrant/hooks/qdrant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from qdrant_client import QdrantClient
2525
from qdrant_client.http.exceptions import UnexpectedResponse
2626

27-
from airflow.providers.qdrant.version_compat import BaseHook
27+
from airflow.providers.common.compat.sdk import BaseHook
2828

2929

3030
class QdrantHook(BaseHook):

providers/qdrant/src/airflow/providers/qdrant/operators/qdrant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from functools import cached_property
2222
from typing import TYPE_CHECKING, Any
2323

24+
from airflow.providers.common.compat.sdk import BaseOperator
2425
from airflow.providers.qdrant.hooks.qdrant import QdrantHook
25-
from airflow.providers.qdrant.version_compat import BaseOperator
2626

2727
if TYPE_CHECKING:
2828
from qdrant_client.models import VectorStruct

providers/qdrant/src/airflow/providers/qdrant/version_compat.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
3030
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
3131
AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)
3232

33-
if AIRFLOW_V_3_0_PLUS:
34-
from airflow.sdk import BaseOperator
35-
else:
36-
from airflow.models import BaseOperator
37-
38-
if AIRFLOW_V_3_1_PLUS:
39-
from airflow.sdk import BaseHook
40-
else:
41-
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
42-
43-
__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "BaseOperator"]
33+
__all__ = [
34+
"AIRFLOW_V_3_0_PLUS",
35+
"AIRFLOW_V_3_1_PLUS",
36+
]

0 commit comments

Comments
 (0)