Skip to content

Commit

Permalink
Remove backcompat with Airflow 2.3/2.4 in providers (#35727)
Browse files Browse the repository at this point in the history
* Remove backcompat with Airflow 2.3/2.4 in providers

* Revert changes in sql.py
  • Loading branch information
Taragolis committed Nov 20, 2023
1 parent 0d1c8de commit d8075cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
9 changes: 1 addition & 8 deletions airflow/providers/google/cloud/hooks/gcs.py
Expand Up @@ -45,6 +45,7 @@
from airflow.providers.google.cloud.utils.helpers import normalize_directory_path
from airflow.providers.google.common.consts import CLIENT_INFO
from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
from airflow.typing_compat import ParamSpec
from airflow.utils import timezone
from airflow.version import version

Expand All @@ -54,14 +55,6 @@
from aiohttp import ClientSession
from google.api_core.retry import Retry

try:
# Airflow 2.3 doesn't have this yet
from airflow.typing_compat import ParamSpec
except ImportError:
try:
from typing import ParamSpec # type: ignore[no-redef, attr-defined]
except ImportError:
from typing_extensions import ParamSpec

RT = TypeVar("RT")
T = TypeVar("T", bound=Callable)
Expand Down
14 changes: 6 additions & 8 deletions airflow/providers/google/cloud/secrets/secret_manager.py
Expand Up @@ -28,7 +28,6 @@
from airflow.providers.google.cloud.utils.credentials_provider import get_credentials_and_project_id
from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow.version import version as airflow_version

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -154,13 +153,12 @@ def get_conn_uri(self, conn_id: str) -> str | None:
:param conn_id: the connection id
:return: deserialized Connection
"""
if _parse_version(airflow_version) >= (2, 3):
warnings.warn(
f"Method `{self.__class__.__name__}.get_conn_uri` is deprecated and will be removed "
"in a future release. Please use method `get_conn_value` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
warnings.warn(
f"Method `{self.__class__.__name__}.get_conn_uri` is deprecated and will be removed "
"in a future release. Please use method `get_conn_value` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
return self.get_conn_value(conn_id)

def get_variable(self, key: str) -> str | None:
Expand Down
14 changes: 6 additions & 8 deletions airflow/providers/microsoft/azure/secrets/key_vault.py
Expand Up @@ -38,7 +38,6 @@
from airflow.providers.microsoft.azure.utils import get_sync_default_azure_credential
from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow.version import version as airflow_version


def _parse_version(val):
Expand Down Expand Up @@ -170,13 +169,12 @@ def get_conn_uri(self, conn_id: str) -> str | None:
:param conn_id: the connection id
:return: deserialized Connection
"""
if _parse_version(airflow_version) >= (2, 3):
warnings.warn(
f"Method `{self.__class__.__name__}.get_conn_uri` is deprecated and will be removed "
"in a future release. Please use method `get_conn_value` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
warnings.warn(
f"Method `{self.__class__.__name__}.get_conn_uri` is deprecated and will be removed "
"in a future release. Please use method `get_conn_value` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
return self.get_conn_value(conn_id)

def get_variable(self, key: str) -> str | None:
Expand Down

0 comments on commit d8075cd

Please sign in to comment.