From b93d57ec1b3d9ed994442fec4cc02b5363d70579 Mon Sep 17 00:00:00 2001 From: Jens Scheffler Date: Fri, 6 Dec 2024 22:37:10 +0100 Subject: [PATCH] Remove Provider Deprecations in Vertica --- .../airflow/providers/vertica/CHANGELOG.rst | 13 +++++ .../providers/vertica/operators/__init__.py | 17 ------ .../providers/vertica/operators/vertica.py | 53 ------------------- .../airflow/providers/vertica/provider.yaml | 5 -- providers/tests/vertica/operators/__init__.py | 17 ------ .../tests/vertica/operators/test_vertica.py | 47 ---------------- 6 files changed, 13 insertions(+), 139 deletions(-) delete mode 100644 providers/src/airflow/providers/vertica/operators/__init__.py delete mode 100644 providers/src/airflow/providers/vertica/operators/vertica.py delete mode 100644 providers/tests/vertica/operators/__init__.py delete mode 100644 providers/tests/vertica/operators/test_vertica.py diff --git a/providers/src/airflow/providers/vertica/CHANGELOG.rst b/providers/src/airflow/providers/vertica/CHANGELOG.rst index 1329aa22700f0..d36d621dc02f7 100644 --- a/providers/src/airflow/providers/vertica/CHANGELOG.rst +++ b/providers/src/airflow/providers/vertica/CHANGELOG.rst @@ -28,6 +28,19 @@ Changelog --------- +main +.... + +Breaking changes +~~~~~~~~~~~~~~~~ + +.. warning:: + All deprecated classes, parameters and features have been removed from the Vertica provider package. + The following breaking changes were introduced: + + * Operators + * Remove ``airflow.providers.vertica.operators.vertica.VerticaOperator``. Please use ``airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator``. + 3.9.1 ..... diff --git a/providers/src/airflow/providers/vertica/operators/__init__.py b/providers/src/airflow/providers/vertica/operators/__init__.py deleted file mode 100644 index 217e5db960782..0000000000000 --- a/providers/src/airflow/providers/vertica/operators/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. diff --git a/providers/src/airflow/providers/vertica/operators/vertica.py b/providers/src/airflow/providers/vertica/operators/vertica.py deleted file mode 100644 index 1077fbaa0ee58..0000000000000 --- a/providers/src/airflow/providers/vertica/operators/vertica.py +++ /dev/null @@ -1,53 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -from __future__ import annotations - -from collections.abc import Sequence -from typing import Any, ClassVar - -from deprecated import deprecated - -from airflow.exceptions import AirflowProviderDeprecationWarning -from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator - - -@deprecated( - reason="Please use `airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.", - category=AirflowProviderDeprecationWarning, -) -class VerticaOperator(SQLExecuteQueryOperator): - """ - Executes sql code in a specific Vertica database. - - This class is deprecated. - - Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`. - - :param vertica_conn_id: reference to a specific Vertica database - :param sql: the SQL code to be executed as a single string, or - a list of str (sql statements), or a reference to a template file. - Template references are recognized by str ending in '.sql' - """ - - template_fields: Sequence[str] = ("sql",) - template_ext: Sequence[str] = (".sql",) - template_fields_renderers: ClassVar[dict] = {"sql": "sql"} - ui_color = "#b4e0ff" - - def __init__(self, *, vertica_conn_id: str = "vertica_default", **kwargs: Any) -> None: - super().__init__(conn_id=vertica_conn_id, **kwargs) diff --git a/providers/src/airflow/providers/vertica/provider.yaml b/providers/src/airflow/providers/vertica/provider.yaml index 564f26f1c91f5..8e55440be6fd1 100644 --- a/providers/src/airflow/providers/vertica/provider.yaml +++ b/providers/src/airflow/providers/vertica/provider.yaml @@ -64,11 +64,6 @@ integrations: logo: /integration-logos/vertica/Vertica.png tags: [software] -operators: - - integration-name: Vertica - python-modules: - - airflow.providers.vertica.operators.vertica - hooks: - integration-name: Vertica python-modules: diff --git a/providers/tests/vertica/operators/__init__.py b/providers/tests/vertica/operators/__init__.py deleted file mode 100644 index 217e5db960782..0000000000000 --- a/providers/tests/vertica/operators/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. diff --git a/providers/tests/vertica/operators/test_vertica.py b/providers/tests/vertica/operators/test_vertica.py deleted file mode 100644 index 0668a7304e384..0000000000000 --- a/providers/tests/vertica/operators/test_vertica.py +++ /dev/null @@ -1,47 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -from __future__ import annotations - -import re -from unittest import mock - -import pytest - -from airflow.exceptions import AirflowProviderDeprecationWarning -from airflow.providers.common.sql.hooks.sql import fetch_all_handler -from airflow.providers.vertica.operators.vertica import VerticaOperator - - -class TestVerticaOperator: - @mock.patch("airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator.get_db_hook") - def test_execute(self, mock_get_db_hook): - sql = "select a, b, c" - warning_message = re.escape( - "Please use `airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`" - ) - with pytest.warns(AirflowProviderDeprecationWarning, match=warning_message): - op = VerticaOperator(task_id="test_task_id", sql=sql) - op.execute({}) - - mock_get_db_hook.return_value.run.assert_called_once_with( - sql=sql, - autocommit=False, - handler=fetch_all_handler, - parameters=None, - return_last=True, - )