Skip to content

Commit

Permalink
Merge branch 'main' into sftp-remove-deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsrahul1001 authored Dec 7, 2024
2 parents 5f7d1e1 + 8bbba50 commit 6e86b5e
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 440 deletions.
3 changes: 1 addition & 2 deletions airflow/ui/src/layouts/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Box, Flex, VStack, Link } from "@chakra-ui/react";
import { FiCornerUpLeft, FiDatabase, FiHome, FiSettings } from "react-icons/fi";

import { useVersionServiceGetVersion } from "openapi/queries";

import { AirflowPin } from "src/assets/AirflowPin";
import { DagIcon } from "src/assets/DagIcon";

Expand Down Expand Up @@ -89,4 +88,4 @@ export const Nav = () => {
</Flex>
</VStack>
);
}
};
14 changes: 0 additions & 14 deletions docs/apache-airflow-providers-oracle/operators/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ Oracle Operators
================
The Oracle connection type provides connection to a Oracle database.

Execute SQL in an Oracle database
---------------------------------

To execute arbitrary SQL in an Oracle database, use the
:class:`~airflow.providers.oracle.operators.oracle.OracleOperator`.

An example of executing a simple query is as follows:

.. exampleinclude:: /../../providers/src/airflow/providers/oracle/example_dags/example_oracle.py
:language: python
:start-after: [START howto_oracle_operator]
:end-before: [END howto_oracle_operator]


Execute a Stored Procedure in an Oracle database
------------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions providers/src/airflow/providers/apache/hive/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

Changelog
---------
main
....

.. warning::
All deprecated classes, parameters and features have been removed from the {provider_name} provider package.
The following breaking changes were introduced:

* Removed deprecated ``GSSAPI`` for ``auth_mechanism.`` Use ``KERBEROS`` instead.

8.2.1
.....
Expand Down
8 changes: 0 additions & 8 deletions providers/src/airflow/providers/apache/hive/hooks/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,14 +873,6 @@ def get_conn(self, schema: str | None = None) -> Any:
auth_mechanism = db.extra_dejson.get("auth_mechanism", "KERBEROS")
kerberos_service_name = db.extra_dejson.get("kerberos_service_name", "hive")

# pyhive uses GSSAPI instead of KERBEROS as a auth_mechanism identifier
if auth_mechanism == "GSSAPI":
self.log.warning(
"Detected deprecated 'GSSAPI' for auth_mechanism for %s. Please use 'KERBEROS' instead",
self.hiveserver2_conn_id, # type: ignore
)
auth_mechanism = "KERBEROS"

# Password should be set if and only if in LDAP or CUSTOM mode
if auth_mechanism in ("LDAP", "CUSTOM"):
password = db.password
Expand Down
12 changes: 12 additions & 0 deletions providers/src/airflow/providers/hashicorp/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
Changelog
---------

main
.....

.. warning::
All deprecated classes, parameters and features have been removed from the hashicorp provider package.
The following breaking changes were introduced:

* The usage of role_id for AppRole authentication has been deprecated from airflow.providers.hashicorp.hook.vault .Please use connection login
* The usage of role_id in connection extra for AppRole authentication has been deprecated from airflow.providers.hashicorp.hook.vault. Please use connection login
* Removed role_id from get_connection_form_widgets
* Removed deprecated method ``VaultBackend.get_conn_uri`` from airflow.providers.hashicorp.secrets.vault

3.8.0
.....

Expand Down
25 changes: 3 additions & 22 deletions providers/src/airflow/providers/hashicorp/hooks/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
from __future__ import annotations

import json
import warnings
from typing import TYPE_CHECKING, Any

from hvac.exceptions import VaultError

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.hooks.base import BaseHook
from airflow.providers.hashicorp._internal_client.vault_client import (
DEFAULT_KUBERNETES_JWT_PATH,
Expand Down Expand Up @@ -70,7 +68,7 @@ class VaultHook(BaseHook):
Login/Password are used as credentials:
* approle: login -> role_id, password -> secret_id
* approle: login -> connection.login
* github: password -> token
* token: password -> token
* aws_iam: login -> key_id, password -> secret_id
Expand Down Expand Up @@ -147,24 +145,8 @@ def __init__(
if kwargs:
client_kwargs = merge_dicts(client_kwargs, kwargs)

if auth_type == "approle":
if role_id:
warnings.warn(
"""The usage of role_id for AppRole authentication has been deprecated.
Please use connection login.""",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
elif self.connection.extra_dejson.get("role_id"):
role_id = self.connection.extra_dejson.get("role_id")
warnings.warn(
"""The usage of role_id in connection extra for AppRole authentication has been
deprecated. Please use connection login.""",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
elif self.connection.login:
role_id = self.connection.login
if auth_type == "approle" and self.connection.login:
role_id = self.connection.login

if auth_type == "aws_iam":
if not role_id:
Expand Down Expand Up @@ -385,7 +367,6 @@ def get_connection_form_widgets(cls) -> dict[str, Any]:
description="Must be 1 or 2.",
default=DEFAULT_KV_ENGINE_VERSION,
),
"role_id": StringField(lazy_gettext("Role ID (deprecated)"), widget=BS3TextFieldWidget()),
"kubernetes_role": StringField(lazy_gettext("Kubernetes role"), widget=BS3TextFieldWidget()),
"kubernetes_jwt_path": StringField(
lazy_gettext("Kubernetes jwt path"), widget=BS3TextFieldWidget()
Expand Down
19 changes: 0 additions & 19 deletions providers/src/airflow/providers/hashicorp/secrets/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

from typing import TYPE_CHECKING

from deprecated import deprecated

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.hashicorp._internal_client.vault_client import _VaultClient
from airflow.secrets import BaseSecretsBackend
from airflow.utils.log.logging_mixin import LoggingMixin
Expand Down Expand Up @@ -191,22 +188,6 @@ def get_response(self, conn_id: str) -> dict | None:
secret_path=(mount_point + "/" if mount_point else "") + secret_path
)

@deprecated(
reason="Method `VaultBackend.get_conn_uri` is deprecated and will be removed in a future release.",
category=AirflowProviderDeprecationWarning,
)
def get_conn_uri(self, conn_id: str) -> str | None:
"""
Get serialized representation of connection.
:param conn_id: The connection id
:return: The connection uri retrieved from the secret
"""
# Since VaultBackend implements `get_connection`, `get_conn_uri` is not used. So we
# don't need to implement (or direct users to use) method `get_conn_value` instead
response = self.get_response(conn_id)
return response.get("conn_uri") if response else None

# Make sure connection is imported this way for type checking, otherwise when importing
# the backend it will get a circular dependency and fail
if TYPE_CHECKING:
Expand Down
15 changes: 15 additions & 0 deletions providers/src/airflow/providers/oracle/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
Changelog
---------

main
....

Breaking changes
~~~~~~~~~~~~~~~~

.. warning::
All deprecated classes, parameters and features have been removed from the Oracle provider package.
The following breaking changes were introduced:

* Hooks
* Remove deprecated support setting the Oracle Service Name using ``conn.schema``. Please use ``conn.extra.service_name`` instead.
* Operators
* Remove ``airflow.providers.oracle.operators.oracle.OracleOperator``. Please use ``airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`` instead.

3.12.1
......

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from datetime import datetime

from airflow import DAG
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from airflow.providers.oracle.operators.oracle import OracleStoredProcedureOperator

with DAG(
Expand All @@ -29,14 +28,6 @@
start_date=datetime(2023, 1, 1),
dag_id="example_oracle",
) as dag:
# [START howto_oracle_operator]

opr_sql = SQLExecuteQueryOperator(
task_id="task_sql", conn_id="oracle", sql="SELECT 1 FROM DUAL", autocommit=True
)

# [END howto_oracle_operator]

# [START howto_oracle_stored_procedure_operator_with_list_inout]

opr_stored_procedure_with_list_input_output = OracleStoredProcedureOperator(
Expand Down
9 changes: 0 additions & 9 deletions providers/src/airflow/providers/oracle/hooks/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import oracledb

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.common.sql.hooks.sql import DbApiHook

PARAM_TYPES = {bool, float, int, str}
Expand Down Expand Up @@ -197,14 +196,6 @@ def get_conn(self) -> oracledb.Connection:
dsn += f":{conn.port}"
if service_name:
dsn += f"/{service_name}"
elif conn.schema:
warnings.warn(
"""Using conn.schema to pass the Oracle Service Name is deprecated.
Please use conn.extra.service_name instead.""",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
dsn += f"/{conn.schema}"
conn_config["dsn"] = dsn

if "events" in conn.extra_dejson:
Expand Down
40 changes: 1 addition & 39 deletions providers/src/airflow/providers/oracle/operators/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,55 +19,17 @@

import re
from collections.abc import Sequence
from typing import TYPE_CHECKING, ClassVar
from typing import TYPE_CHECKING

import oracledb
from deprecated import deprecated

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.models import BaseOperator
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
from airflow.providers.oracle.hooks.oracle import OracleHook

if TYPE_CHECKING:
from airflow.utils.context import Context


@deprecated(
reason="Please use `airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.",
category=AirflowProviderDeprecationWarning,
)
class OracleOperator(SQLExecuteQueryOperator):
"""
Executes sql code in a specific Oracle database.
This class is deprecated.
Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.
:param sql: the sql code to be executed. Can receive a str representing a sql statement,
a list of str (sql statements), or reference to a template file.
Template reference are recognized by str ending in '.sql'
(templated)
:param oracle_conn_id: The :ref:`Oracle connection id <howto/connection:oracle>`
reference to a specific Oracle database.
:param parameters: (optional, templated) the parameters to render the SQL query with.
:param autocommit: if True, each command is automatically committed.
(default value: False)
"""

template_fields: Sequence[str] = (
"parameters",
"sql",
)
template_ext: Sequence[str] = (".sql",)
template_fields_renderers: ClassVar[dict] = {"sql": "sql"}
ui_color = "#ededed"

def __init__(self, *, oracle_conn_id: str = "oracle_default", **kwargs) -> None:
super().__init__(conn_id=oracle_conn_id, **kwargs)


class OracleStoredProcedureOperator(BaseOperator):
"""
Executes stored procedure in a specific Oracle database.
Expand Down
11 changes: 11 additions & 0 deletions providers/src/airflow/providers/redis/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
Changelog
---------

main
.....

.. warning::
All deprecated classes, parameters and features have been removed from the Redis provider package.
The following breaking changes were introduced:

* Hooks

* Removed ``ssl_cert_file`` parameter from ``RedisHook``. Use ``ssl_certfile`` instead

3.8.0
.....

Expand Down
14 changes: 1 addition & 13 deletions providers/src/airflow/providers/redis/hooks/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@

from __future__ import annotations

import warnings
from typing import Any

from redis import Redis

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.hooks.base import BaseHook

DEFAULT_SSL_CERT_REQS = "required"
Expand All @@ -37,7 +35,7 @@ class RedisHook(BaseHook):
You can set your db in the extra field of your connection as ``{"db": 3}``.
Also you can set ssl parameters as:
``{"ssl": true, "ssl_cert_reqs": "require", "ssl_cert_file": "/path/to/cert.pem", etc}``.
``{"ssl": true, "ssl_cert_reqs": "require", "ssl_certfile": "/path/to/cert.pem", etc}``.
"""

conn_name_attr = "redis_conn_id"
Expand Down Expand Up @@ -81,16 +79,6 @@ def get_conn(self):
]
ssl_args = {name: val for name, val in conn.extra_dejson.items() if name in ssl_arg_names}

# This logic is for backward compatibility only
if "ssl_cert_file" in conn.extra_dejson and "ssl_certfile" not in conn.extra_dejson:
warnings.warn(
"Extra parameter `ssl_cert_file` deprecated and will be removed "
"in a future release. Please use `ssl_certfile` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
ssl_args["ssl_certfile"] = conn.extra_dejson.get("ssl_cert_file")

if not self.redis:
self.log.debug(
'Initializing redis object for conn_id "%s" on %s:%s:%s',
Expand Down
Loading

0 comments on commit 6e86b5e

Please sign in to comment.