Skip to content

Commit b995c85

Browse files
authored
Migrate apache/druid provider to common.compat (apache#57072)
1 parent f69ba00 commit b995c85

File tree

6 files changed

+8
-20
lines changed

6 files changed

+8
-20
lines changed

providers/apache/drill/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ requires-python = ">=3.10"
5959
dependencies = [
6060
"apache-airflow>=2.10.0",
6161
"apache-airflow-providers-common-sql>=1.26.0",
62+
"apache-airflow-providers-common-compat>=1.8.0",
6263
# Workaround until we get https://github.com/JohnOmernik/sqlalchemy-drill/issues/94 fixed.
6364
"sqlalchemy-drill>=1.1.0,!=1.1.6,!=1.1.7",
6465
]

providers/apache/druid/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ requires-python = ">=3.10"
5959
dependencies = [
6060
"apache-airflow>=2.10.0",
6161
"apache-airflow-providers-common-sql>=1.26.0",
62+
"apache-airflow-providers-common-compat>=1.8.0",
6263
"pydruid>=0.6.6",
6364
]
6465

@@ -75,6 +76,7 @@ dev = [
7576
"apache-airflow-task-sdk",
7677
"apache-airflow-devel-common",
7778
"apache-airflow-providers-apache-hive",
79+
"apache-airflow-providers-common-compat",
7880
"apache-airflow-providers-common-sql",
7981
# Additional devel dependencies (do not remove this line and add extra development dependencies)
8082
"apache-airflow-providers-common-sql[pandas,polars]",

providers/apache/druid/src/airflow/providers/apache/druid/hooks/druid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from pydruid.db import connect
2828

2929
from airflow.exceptions import AirflowException
30-
from airflow.providers.apache.druid.version_compat import BaseHook
30+
from airflow.providers.common.compat.sdk import BaseHook
3131
from airflow.providers.common.sql.hooks.sql import DbApiHook
3232

3333
if TYPE_CHECKING:

providers/apache/druid/src/airflow/providers/apache/druid/operators/druid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
from typing import TYPE_CHECKING, Any
2222

2323
from airflow.providers.apache.druid.hooks.druid import DruidHook, IngestionType
24-
from airflow.providers.apache.druid.version_compat import BaseOperator
24+
from airflow.providers.common.compat.sdk import BaseOperator
2525

2626
if TYPE_CHECKING:
27-
from airflow.providers.apache.druid.version_compat import Context
27+
from airflow.providers.common.compat.sdk import Context
2828

2929

3030
class DruidOperator(BaseOperator):

providers/apache/druid/src/airflow/providers/apache/druid/transfers/hive_to_druid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
from typing import TYPE_CHECKING, Any
2424

2525
from airflow.providers.apache.druid.hooks.druid import DruidHook
26-
from airflow.providers.apache.druid.version_compat import BaseOperator
2726
from airflow.providers.apache.hive.hooks.hive import HiveCliHook, HiveMetastoreHook
27+
from airflow.providers.common.compat.sdk import BaseOperator
2828

2929
if TYPE_CHECKING:
30-
from airflow.providers.apache.druid.version_compat import Context
30+
from airflow.providers.common.compat.sdk import Context
3131

3232
LOAD_CHECK_INTERVAL = 5
3333
DEFAULT_TARGET_PARTITION_SIZE = 5000000

providers/apache/druid/src/airflow/providers/apache/druid/version_compat.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
3535
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
3636
AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)
3737

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-
if AIRFLOW_V_3_0_PLUS:
44-
from airflow.sdk import BaseOperator
45-
from airflow.sdk.definitions.context import Context
46-
else:
47-
from airflow.models import BaseOperator
48-
from airflow.utils.context import Context
49-
5038
__all__ = [
5139
"AIRFLOW_V_3_0_PLUS",
5240
"AIRFLOW_V_3_1_PLUS",
53-
"BaseHook",
54-
"BaseOperator",
55-
"Context",
5641
]

0 commit comments

Comments
 (0)