From cf6946404b36fccba3b09fb57e3ff770334e6f87 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Mon, 5 Sep 2022 20:06:18 +0200 Subject: [PATCH] Remove remaining deprecated classes and replace them with PEP562 This is a follow-up after #26513 - removal of all remaining deprecated classes and replace them with PEP-562 dynamic attribute loading. --- airflow/contrib/hooks/__init__.py | 3 +- airflow/contrib/operators/__init__.py | 3 +- airflow/contrib/secrets/__init__.py | 5 +- airflow/contrib/sensors/__init__.py | 3 +- airflow/contrib/task_runner/__init__.py | 3 +- airflow/contrib/utils/__init__.py | 7 +- airflow/hooks/S3_hook.py | 31 -- airflow/hooks/__init__.py | 74 ++++ airflow/hooks/base_hook.py | 29 -- airflow/hooks/dbapi_hook.py | 29 -- airflow/hooks/docker_hook.py | 29 -- airflow/hooks/druid_hook.py | 29 -- airflow/hooks/hdfs_hook.py | 29 -- airflow/hooks/hive_hooks.py | 34 -- airflow/hooks/http_hook.py | 29 -- airflow/hooks/jdbc_hook.py | 29 -- airflow/hooks/mssql_hook.py | 29 -- airflow/hooks/mysql_hook.py | 29 -- airflow/hooks/oracle_hook.py | 29 -- airflow/hooks/pig_hook.py | 29 -- airflow/hooks/postgres_hook.py | 29 -- airflow/hooks/presto_hook.py | 29 -- airflow/hooks/samba_hook.py | 29 -- airflow/hooks/slack_hook.py | 29 -- airflow/hooks/sqlite_hook.py | 29 -- airflow/hooks/webhdfs_hook.py | 29 -- airflow/hooks/zendesk_hook.py | 29 -- airflow/operators/__init__.py | 175 ++++++++ airflow/operators/bash_operator.py | 29 -- airflow/operators/branch_operator.py | 29 -- airflow/operators/check_operator.py | 99 ----- airflow/operators/dagrun_operator.py | 29 -- airflow/operators/docker_operator.py | 29 -- airflow/operators/druid_check_operator.py | 29 -- airflow/operators/dummy.py | 46 --- airflow/operators/dummy_operator.py | 41 -- airflow/operators/email_operator.py | 29 -- airflow/operators/gcs_to_s3.py | 29 -- .../operators/google_api_to_s3_transfer.py | 51 --- airflow/operators/hive_operator.py | 29 -- airflow/operators/hive_stats_operator.py | 29 -- airflow/operators/hive_to_druid.py | 50 --- airflow/operators/hive_to_mysql.py | 50 --- airflow/operators/hive_to_samba_operator.py | 29 -- airflow/operators/http_operator.py | 29 -- airflow/operators/jdbc_operator.py | 29 -- airflow/operators/latest_only_operator.py | 28 -- airflow/operators/mssql_operator.py | 29 -- airflow/operators/mssql_to_hive.py | 50 --- airflow/operators/mysql_operator.py | 29 -- airflow/operators/mysql_to_hive.py | 45 -- airflow/operators/oracle_operator.py | 29 -- airflow/operators/papermill_operator.py | 29 -- airflow/operators/pig_operator.py | 29 -- airflow/operators/postgres_operator.py | 29 -- airflow/operators/presto_check_operator.py | 85 ---- airflow/operators/presto_to_mysql.py | 50 --- airflow/operators/python_operator.py | 34 -- airflow/operators/redshift_to_s3_operator.py | 49 --- .../operators/s3_file_transform_operator.py | 32 -- airflow/operators/s3_to_hive_operator.py | 45 -- airflow/operators/s3_to_redshift_operator.py | 50 --- airflow/operators/slack_operator.py | 29 -- airflow/operators/sql.py | 38 -- airflow/operators/sql_branch_operator.py | 43 -- airflow/operators/sqlite_operator.py | 29 -- airflow/operators/subdag_operator.py | 29 -- airflow/sensors/__init__.py | 52 +++ airflow/sensors/base_sensor_operator.py | 29 -- airflow/sensors/date_time_sensor.py | 29 -- airflow/sensors/external_task_sensor.py | 33 -- airflow/sensors/hdfs_sensor.py | 30 -- airflow/sensors/hive_partition_sensor.py | 29 -- airflow/sensors/http_sensor.py | 29 -- airflow/sensors/metastore_partition_sensor.py | 32 -- .../sensors/named_hive_partition_sensor.py | 29 -- airflow/sensors/s3_key_sensor.py | 29 -- airflow/sensors/sql.py | 27 -- airflow/sensors/sql_sensor.py | 29 -- airflow/sensors/time_delta_sensor.py | 29 -- airflow/sensors/web_hdfs_sensor.py | 29 -- airflow/utils/log/__init__.py | 31 ++ airflow/utils/log/cloudwatch_task_handler.py | 28 -- airflow/utils/log/es_task_handler.py | 28 -- airflow/utils/log/gcs_task_handler.py | 28 -- airflow/utils/log/s3_task_handler.py | 28 -- airflow/utils/log/stackdriver_task_handler.py | 30 -- airflow/utils/log/wasb_task_handler.py | 28 -- tests/always/test_deprecations.py | 114 ----- tests/deprecated_classes.py | 390 ------------------ tests/operators/test_dummy.py | 25 -- .../common/sql/operators/test_sql.py | 14 +- tests/serialization/test_dag_serialization.py | 40 -- 93 files changed, 357 insertions(+), 3217 deletions(-) delete mode 100644 airflow/hooks/S3_hook.py delete mode 100644 airflow/hooks/base_hook.py delete mode 100644 airflow/hooks/dbapi_hook.py delete mode 100644 airflow/hooks/docker_hook.py delete mode 100644 airflow/hooks/druid_hook.py delete mode 100644 airflow/hooks/hdfs_hook.py delete mode 100644 airflow/hooks/hive_hooks.py delete mode 100644 airflow/hooks/http_hook.py delete mode 100644 airflow/hooks/jdbc_hook.py delete mode 100644 airflow/hooks/mssql_hook.py delete mode 100644 airflow/hooks/mysql_hook.py delete mode 100644 airflow/hooks/oracle_hook.py delete mode 100644 airflow/hooks/pig_hook.py delete mode 100644 airflow/hooks/postgres_hook.py delete mode 100644 airflow/hooks/presto_hook.py delete mode 100644 airflow/hooks/samba_hook.py delete mode 100644 airflow/hooks/slack_hook.py delete mode 100644 airflow/hooks/sqlite_hook.py delete mode 100644 airflow/hooks/webhdfs_hook.py delete mode 100644 airflow/hooks/zendesk_hook.py delete mode 100644 airflow/operators/bash_operator.py delete mode 100644 airflow/operators/branch_operator.py delete mode 100644 airflow/operators/check_operator.py delete mode 100644 airflow/operators/dagrun_operator.py delete mode 100644 airflow/operators/docker_operator.py delete mode 100644 airflow/operators/druid_check_operator.py delete mode 100644 airflow/operators/dummy.py delete mode 100644 airflow/operators/dummy_operator.py delete mode 100644 airflow/operators/email_operator.py delete mode 100644 airflow/operators/gcs_to_s3.py delete mode 100644 airflow/operators/google_api_to_s3_transfer.py delete mode 100644 airflow/operators/hive_operator.py delete mode 100644 airflow/operators/hive_stats_operator.py delete mode 100644 airflow/operators/hive_to_druid.py delete mode 100644 airflow/operators/hive_to_mysql.py delete mode 100644 airflow/operators/hive_to_samba_operator.py delete mode 100644 airflow/operators/http_operator.py delete mode 100644 airflow/operators/jdbc_operator.py delete mode 100644 airflow/operators/latest_only_operator.py delete mode 100644 airflow/operators/mssql_operator.py delete mode 100644 airflow/operators/mssql_to_hive.py delete mode 100644 airflow/operators/mysql_operator.py delete mode 100644 airflow/operators/mysql_to_hive.py delete mode 100644 airflow/operators/oracle_operator.py delete mode 100644 airflow/operators/papermill_operator.py delete mode 100644 airflow/operators/pig_operator.py delete mode 100644 airflow/operators/postgres_operator.py delete mode 100644 airflow/operators/presto_check_operator.py delete mode 100644 airflow/operators/presto_to_mysql.py delete mode 100644 airflow/operators/python_operator.py delete mode 100644 airflow/operators/redshift_to_s3_operator.py delete mode 100644 airflow/operators/s3_file_transform_operator.py delete mode 100644 airflow/operators/s3_to_hive_operator.py delete mode 100644 airflow/operators/s3_to_redshift_operator.py delete mode 100644 airflow/operators/slack_operator.py delete mode 100644 airflow/operators/sql.py delete mode 100644 airflow/operators/sql_branch_operator.py delete mode 100644 airflow/operators/sqlite_operator.py delete mode 100644 airflow/operators/subdag_operator.py delete mode 100644 airflow/sensors/base_sensor_operator.py delete mode 100644 airflow/sensors/date_time_sensor.py delete mode 100644 airflow/sensors/external_task_sensor.py delete mode 100644 airflow/sensors/hdfs_sensor.py delete mode 100644 airflow/sensors/hive_partition_sensor.py delete mode 100644 airflow/sensors/http_sensor.py delete mode 100644 airflow/sensors/metastore_partition_sensor.py delete mode 100644 airflow/sensors/named_hive_partition_sensor.py delete mode 100644 airflow/sensors/s3_key_sensor.py delete mode 100644 airflow/sensors/sql.py delete mode 100644 airflow/sensors/sql_sensor.py delete mode 100644 airflow/sensors/time_delta_sensor.py delete mode 100644 airflow/sensors/web_hdfs_sensor.py delete mode 100644 airflow/utils/log/cloudwatch_task_handler.py delete mode 100644 airflow/utils/log/es_task_handler.py delete mode 100644 airflow/utils/log/gcs_task_handler.py delete mode 100644 airflow/utils/log/s3_task_handler.py delete mode 100644 airflow/utils/log/stackdriver_task_handler.py delete mode 100644 airflow/utils/log/wasb_task_handler.py delete mode 100644 tests/always/test_deprecations.py delete mode 100644 tests/deprecated_classes.py delete mode 100644 tests/operators/test_dummy.py diff --git a/airflow/contrib/hooks/__init__.py b/airflow/contrib/hooks/__init__.py index 62247ecf04c11..397cb011c26a9 100644 --- a/airflow/contrib/hooks/__init__.py +++ b/airflow/contrib/hooks/__init__.py @@ -19,11 +19,12 @@ """This package is deprecated. Please use `airflow.hooks` or `airflow.providers.*.hooks`.""" import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes warnings.warn( "This package is deprecated. Please use `airflow.hooks` or `airflow.providers.*.hooks`.", - DeprecationWarning, + RemovedInAirflow3Warning, stacklevel=2, ) diff --git a/airflow/contrib/operators/__init__.py b/airflow/contrib/operators/__init__.py index d3a4c0cdd6194..03b54fb511154 100644 --- a/airflow/contrib/operators/__init__.py +++ b/airflow/contrib/operators/__init__.py @@ -19,11 +19,12 @@ """This package is deprecated. Please use `airflow.operators` or `airflow.providers.*.operators`.""" import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes warnings.warn( "This package is deprecated. Please use `airflow.operators` or `airflow.providers.*.operators`.", - DeprecationWarning, + RemovedInAirflow3Warning, stacklevel=2, ) diff --git a/airflow/contrib/secrets/__init__.py b/airflow/contrib/secrets/__init__.py index c9134627b1d3a..77c53d009de1d 100644 --- a/airflow/contrib/secrets/__init__.py +++ b/airflow/contrib/secrets/__init__.py @@ -18,10 +18,13 @@ """This package is deprecated. Please use `airflow.secrets` or `airflow.providers.*.secrets`.""" import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes warnings.warn( - "This module is deprecated. Please use airflow.providers.*.secrets.", DeprecationWarning, stacklevel=2 + "This module is deprecated. Please use airflow.providers.*.secrets.", + RemovedInAirflow3Warning, + stacklevel=2 ) __deprecated_classes = { diff --git a/airflow/contrib/sensors/__init__.py b/airflow/contrib/sensors/__init__.py index 78afebe42fb7e..259ba1674a269 100644 --- a/airflow/contrib/sensors/__init__.py +++ b/airflow/contrib/sensors/__init__.py @@ -19,11 +19,12 @@ import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes warnings.warn( "This package is deprecated. Please use `airflow.sensors` or `airflow.providers.*.sensors`.", - DeprecationWarning, + RemovedInAirflow3Warning, stacklevel=2, ) diff --git a/airflow/contrib/task_runner/__init__.py b/airflow/contrib/task_runner/__init__.py index 069e2c4613822..a918d5d11d2cc 100644 --- a/airflow/contrib/task_runner/__init__.py +++ b/airflow/contrib/task_runner/__init__.py @@ -18,10 +18,11 @@ """This package is deprecated. Please use `airflow.task.task_runner`.""" import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes warnings.warn( - "This module is deprecated. Please use airflow.task.task_runner.", DeprecationWarning, stacklevel=2 + "This module is deprecated. Please use airflow.task.task_runner.", RemovedInAirflow3Warning, stacklevel=2 ) __deprecated_classes = { diff --git a/airflow/contrib/utils/__init__.py b/airflow/contrib/utils/__init__.py index 44f24ba453a85..8e921940f6c98 100644 --- a/airflow/contrib/utils/__init__.py +++ b/airflow/contrib/utils/__init__.py @@ -19,9 +19,14 @@ import warnings +from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.deprecation_tools import add_deprecated_classes -warnings.warn("This module is deprecated. Please use `airflow.utils`.", DeprecationWarning, stacklevel=2) +warnings.warn( + "This module is deprecated. Please use `airflow.utils`.", + RemovedInAirflow3Warning, + stacklevel=2 +) __deprecated_classes = { 'gcp_field_sanitizer': { diff --git a/airflow/hooks/S3_hook.py b/airflow/hooks/S3_hook.py deleted file mode 100644 index 1a0bf5bfc9c6b..0000000000000 --- a/airflow/hooks/S3_hook.py +++ /dev/null @@ -1,31 +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. - - -"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.hooks.s3`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.hooks.s3 import S3Hook, provide_bucket_name # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.s3`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/__init__.py b/airflow/hooks/__init__.py index 5c933400c2f8a..44556107cdfe7 100644 --- a/airflow/hooks/__init__.py +++ b/airflow/hooks/__init__.py @@ -15,4 +15,78 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# fmt: off """Hooks.""" +from airflow.utils.deprecation_tools import add_deprecated_classes + +__deprecated_classes = { + 'S3_hook': { + 'S3Hook': 'airflow.providers.amazon.aws.hooks.s3.S3Hook', + 'provide_bucket_name': 'airflow.providers.amazon.aws.hooks.s3.provide_bucket_name', + }, + 'base_hook': { + 'BaseHook': 'airflow.hooks.base.BaseHook', + }, + 'dbapi_hook': { + 'DbApiHook': 'airflow.providers.common.sql.hooks.sql.DbApiHook', + }, + 'docker_hook': { + 'DockerHook': 'airflow.providers.docker.hooks.docker.DockerHook', + }, + 'druid_hook': { + 'DruidDbApiHook': 'airflow.providers.apache.druid.hooks.druid.DruidDbApiHook', + 'DruidHook': 'airflow.providers.apache.druid.hooks.druid.DruidHook', + }, + 'hdfs_hook': { + 'HDFSHook': 'airflow.providers.apache.hdfs.hooks.hdfs.HDFSHook', + 'HDFSHookException': 'airflow.providers.apache.hdfs.hooks.hdfs.HDFSHookException', + }, + 'hive_hooks': { + 'HIVE_QUEUE_PRIORITIES': 'airflow.providers.apache.hive.hooks.hive.HIVE_QUEUE_PRIORITIES', + 'HiveCliHook': 'airflow.providers.apache.hive.hooks.hive.HiveCliHook', + 'HiveMetastoreHook': 'airflow.providers.apache.hive.hooks.hive.HiveMetastoreHook', + 'HiveServer2Hook': 'airflow.providers.apache.hive.hooks.hive.HiveServer2Hook', + }, + 'http_hook': { + 'HttpHook': 'airflow.providers.http.hooks.http.HttpHook', + }, + 'jdbc_hook': { + 'JdbcHook': 'airflow.providers.jdbc.hooks.jdbc.JdbcHook', + 'jaydebeapi': 'airflow.providers.jdbc.hooks.jdbc.jaydebeapi', + }, + 'mssql_hook': { + 'MsSqlHook': 'airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook', + }, + 'mysql_hook': { + 'MySqlHook': 'airflow.providers.mysql.hooks.mysql.MySqlHook', + }, + 'oracle_hook': { + 'OracleHook': 'airflow.providers.oracle.hooks.oracle.OracleHook', + }, + 'pig_hook': { + 'PigCliHook': 'airflow.providers.apache.pig.hooks.pig.PigCliHook', + }, + 'postgres_hook': { + 'PostgresHook': 'airflow.providers.postgres.hooks.postgres.PostgresHook', + }, + 'presto_hook': { + 'PrestoHook': 'airflow.providers.presto.hooks.presto.PrestoHook', + }, + 'samba_hook': { + 'SambaHook': 'airflow.providers.samba.hooks.samba.SambaHook', + }, + 'slack_hook': { + 'SlackHook': 'airflow.providers.slack.hooks.slack.SlackHook', + }, + 'sqlite_hook': { + 'SqliteHook': 'airflow.providers.sqlite.hooks.sqlite.SqliteHook', + }, + 'webhdfs_hook': { + 'WebHDFSHook': 'airflow.providers.apache.hdfs.hooks.webhdfs.WebHDFSHook', + }, + 'zendesk_hook': { + 'ZendeskHook': 'airflow.providers.zendesk.hooks.zendesk.ZendeskHook', + }, +} + +add_deprecated_classes(__deprecated_classes, __name__) diff --git a/airflow/hooks/base_hook.py b/airflow/hooks/base_hook.py deleted file mode 100644 index 161278eabbd56..0000000000000 --- a/airflow/hooks/base_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.hooks.base`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.hooks.base import BaseHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.hooks.base`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py deleted file mode 100644 index 0ea5fdcfa4439..0000000000000 --- a/airflow/hooks/dbapi_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.hooks.dbapi`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.hooks.sql import DbApiHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.hooks.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/docker_hook.py b/airflow/hooks/docker_hook.py deleted file mode 100644 index b2f56430de945..0000000000000 --- a/airflow/hooks/docker_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.docker.hooks.docker`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.docker.hooks.docker import DockerHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.docker.hooks.docker`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/druid_hook.py b/airflow/hooks/druid_hook.py deleted file mode 100644 index 9ce11f8078a85..0000000000000 --- a/airflow/hooks/druid_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.druid.hooks.druid`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.druid.hooks.druid import DruidDbApiHook, DruidHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.druid.hooks.druid`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/hdfs_hook.py b/airflow/hooks/hdfs_hook.py deleted file mode 100644 index 7d7b115959ac7..0000000000000 --- a/airflow/hooks/hdfs_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hdfs.hooks.hdfs`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hdfs.hooks.hdfs import HDFSHook, HDFSHookException # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hdfs.hooks.hdfs`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/hive_hooks.py b/airflow/hooks/hive_hooks.py deleted file mode 100644 index bc8ebed405261..0000000000000 --- a/airflow/hooks/hive_hooks.py +++ /dev/null @@ -1,34 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.hooks.hive`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.hooks.hive import ( # noqa - HIVE_QUEUE_PRIORITIES, - HiveCliHook, - HiveMetastoreHook, - HiveServer2Hook, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.hooks.hive`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/http_hook.py b/airflow/hooks/http_hook.py deleted file mode 100644 index 7eceec52915e9..0000000000000 --- a/airflow/hooks/http_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.http.hooks.http`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.http.hooks.http import HttpHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.http.hooks.http`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/jdbc_hook.py b/airflow/hooks/jdbc_hook.py deleted file mode 100644 index 6e73645dfd311..0000000000000 --- a/airflow/hooks/jdbc_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.jdbc.hooks.jdbc`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.jdbc.hooks.jdbc import JdbcHook, jaydebeapi # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.jdbc.hooks.jdbc`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/mssql_hook.py b/airflow/hooks/mssql_hook.py deleted file mode 100644 index f9922c64806c7..0000000000000 --- a/airflow/hooks/mssql_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.microsoft.mssql.hooks.mssql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.microsoft.mssql.hooks.mssql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/mysql_hook.py b/airflow/hooks/mysql_hook.py deleted file mode 100644 index 6520ef62e05e6..0000000000000 --- a/airflow/hooks/mysql_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.mysql.hooks.mysql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.mysql.hooks.mysql import MySqlHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.mysql.hooks.mysql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/oracle_hook.py b/airflow/hooks/oracle_hook.py deleted file mode 100644 index 95fbecb61c313..0000000000000 --- a/airflow/hooks/oracle_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.oracle.hooks.oracle`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.oracle.hooks.oracle import OracleHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.oracle.hooks.oracle`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/pig_hook.py b/airflow/hooks/pig_hook.py deleted file mode 100644 index ebcb068b6e319..0000000000000 --- a/airflow/hooks/pig_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.pig.hooks.pig`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.pig.hooks.pig import PigCliHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.pig.hooks.pig`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/postgres_hook.py b/airflow/hooks/postgres_hook.py deleted file mode 100644 index ce1f690aee108..0000000000000 --- a/airflow/hooks/postgres_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.postgres.hooks.postgres`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.postgres.hooks.postgres import PostgresHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.postgres.hooks.postgres`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/presto_hook.py b/airflow/hooks/presto_hook.py deleted file mode 100644 index 71e3964dec264..0000000000000 --- a/airflow/hooks/presto_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.presto.hooks.presto`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.presto.hooks.presto import PrestoHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.presto.hooks.presto`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/samba_hook.py b/airflow/hooks/samba_hook.py deleted file mode 100644 index c0465c4bd1230..0000000000000 --- a/airflow/hooks/samba_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.samba.hooks.samba`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.samba.hooks.samba import SambaHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.samba.hooks.samba`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/slack_hook.py b/airflow/hooks/slack_hook.py deleted file mode 100644 index da5ccbbd8ac04..0000000000000 --- a/airflow/hooks/slack_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.slack.hooks.slack`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.slack.hooks.slack import SlackHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.slack.hooks.slack`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/sqlite_hook.py b/airflow/hooks/sqlite_hook.py deleted file mode 100644 index c9d0e03dd70d8..0000000000000 --- a/airflow/hooks/sqlite_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.sqlite.hooks.sqlite`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.sqlite.hooks.sqlite import SqliteHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.sqlite.hooks.sqlite`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/webhdfs_hook.py b/airflow/hooks/webhdfs_hook.py deleted file mode 100644 index a16f4dee00649..0000000000000 --- a/airflow/hooks/webhdfs_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hdfs.hooks.webhdfs`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hdfs.hooks.webhdfs import WebHDFSHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hdfs.hooks.webhdfs`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/hooks/zendesk_hook.py b/airflow/hooks/zendesk_hook.py deleted file mode 100644 index 6aaae2b3884da..0000000000000 --- a/airflow/hooks/zendesk_hook.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.zendesk.hooks.zendesk`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.zendesk.hooks.zendesk import ZendeskHook # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.zendesk.hooks.zendesk`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/__init__.py b/airflow/operators/__init__.py index ec83c1e147a32..e0245d7e3431b 100644 --- a/airflow/operators/__init__.py +++ b/airflow/operators/__init__.py @@ -15,4 +15,179 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# fmt: off + """Operators.""" +from airflow.utils.deprecation_tools import add_deprecated_classes + +__deprecated_classes = { + 'bash_operator': { + 'BashOperator': 'airflow.operators.bash.BashOperator', + }, + 'branch_operator': { + 'BaseBranchOperator': 'airflow.operators.branch.BaseBranchOperator', + }, + 'check_operator': { + 'SQLCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', + 'SQLIntervalCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', + 'SQLThresholdCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator', + 'SQLValueCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', + 'CheckOperator': 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', + 'IntervalCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', + 'ThresholdCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator', + 'ValueCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', + }, + 'dagrun_operator': { + 'TriggerDagRunLink': 'airflow.operators.trigger_dagrun.TriggerDagRunLink', + 'TriggerDagRunOperator': 'airflow.operators.trigger_dagrun.TriggerDagRunOperator', + }, + 'docker_operator': { + 'DockerOperator': 'airflow.providers.docker.operators.docker.DockerOperator', + }, + 'druid_check_operator': { + 'DruidCheckOperator': 'airflow.providers.apache.druid.operators.druid_check.DruidCheckOperator', + }, + 'dummy': { + 'EmptyOperator': 'airflow.operators.empty.EmptyOperator', + 'DummyOperator': 'airflow.operators.empty.EmptyOperator', + }, + 'dummy_operator': { + 'EmptyOperator': 'airflow.operators.empty.EmptyOperator', + 'DummyOperator': 'airflow.operators.empty.EmptyOperator', + }, + 'email_operator': { + 'EmailOperator': 'airflow.operators.email.EmailOperator', + }, + 'gcs_to_s3': { + 'GCSToS3Operator': 'airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSToS3Operator', + }, + 'google_api_to_s3_transfer': { + 'GoogleApiToS3Operator': ( + 'airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator' + ), + 'GoogleApiToS3Transfer': ( + 'airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator' + ), + }, + 'hive_operator': { + 'HiveOperator': 'airflow.providers.apache.hive.operators.hive.HiveOperator', + }, + 'hive_stats_operator': { + 'HiveStatsCollectionOperator': ( + 'airflow.providers.apache.hive.operators.hive_stats.HiveStatsCollectionOperator' + ), + }, + 'hive_to_druid': { + 'HiveToDruidOperator': 'airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator', + 'HiveToDruidTransfer': 'airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator', + }, + 'hive_to_mysql': { + 'HiveToMySqlOperator': 'airflow.providers.apache.hive.transfers.hive_to_mysql.HiveToMySqlOperator', + 'HiveToMySqlTransfer': 'airflow.providers.apache.hive.transfers.hive_to_mysql.HiveToMySqlOperator', + }, + 'hive_to_samba_operator': { + 'HiveToSambaOperator': 'airflow.providers.apache.hive.transfers.hive_to_samba.HiveToSambaOperator', + }, + 'http_operator': { + 'SimpleHttpOperator': 'airflow.providers.http.operators.http.SimpleHttpOperator', + }, + 'jdbc_operator': { + 'JdbcOperator': 'airflow.providers.jdbc.operators.jdbc.JdbcOperator', + }, + 'latest_only_operator': { + 'LatestOnlyOperator': 'airflow.operators.latest_only.LatestOnlyOperator', + }, + 'mssql_operator': { + 'MsSqlOperator': 'airflow.providers.microsoft.mssql.operators.mssql.MsSqlOperator', + }, + 'mssql_to_hive': { + 'MsSqlToHiveOperator': 'airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator', + 'MsSqlToHiveTransfer': 'airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator', + }, + 'mysql_operator': { + 'MySqlOperator': 'airflow.providers.mysql.operators.mysql.MySqlOperator', + }, + 'mysql_to_hive': { + 'MySqlToHiveOperator': 'airflow.providers.apache.hive.transfers.mysql_to_hive.MySqlToHiveOperator', + 'MySqlToHiveTransfer': 'airflow.providers.apache.hive.transfers.mysql_to_hive.MySqlToHiveOperator', + }, + 'oracle_operator': { + 'OracleOperator': 'airflow.providers.oracle.operators.oracle.OracleOperator', + }, + 'papermill_operator': { + 'PapermillOperator': 'airflow.providers.papermill.operators.papermill.PapermillOperator', + }, + 'pig_operator': { + 'PigOperator': 'airflow.providers.apache.pig.operators.pig.PigOperator', + }, + 'postgres_operator': { + 'Mapping': 'airflow.providers.postgres.operators.postgres.Mapping', + 'PostgresOperator': 'airflow.providers.postgres.operators.postgres.PostgresOperator', + }, + 'presto_check_operator': { + 'SQLCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', + 'SQLIntervalCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', + 'SQLValueCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', + 'PrestoCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', + 'PrestoIntervalCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', + 'PrestoValueCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', + }, + 'presto_to_mysql': { + 'PrestoToMySqlOperator': 'airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator', + 'PrestoToMySqlTransfer': 'airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator', + }, + 'python_operator': { + 'BranchPythonOperator': 'airflow.operators.python.BranchPythonOperator', + 'PythonOperator': 'airflow.operators.python.PythonOperator', + 'PythonVirtualenvOperator': 'airflow.operators.python.PythonVirtualenvOperator', + 'ShortCircuitOperator': 'airflow.operators.python.ShortCircuitOperator', + }, + 'redshift_to_s3_operator': { + 'RedshiftToS3Operator': 'airflow.providers.amazon.aws.transfers.redshift_to_s3.RedshiftToS3Operator', + 'RedshiftToS3Transfer': 'airflow.providers.amazon.aws.transfers.redshift_to_s3.RedshiftToS3Operator', + }, + 's3_file_transform_operator': { + 'S3FileTransformOperator': ( + 'airflow.providers.amazon.aws.operators.s3_file_transform.S3FileTransformOperator' + ), + }, + 's3_to_hive_operator': { + 'S3ToHiveOperator': 'airflow.providers.apache.hive.transfers.s3_to_hive.S3ToHiveOperator', + 'S3ToHiveTransfer': 'airflow.providers.apache.hive.transfers.s3_to_hive.S3ToHiveOperator', + }, + 's3_to_redshift_operator': { + 'S3ToRedshiftOperator': 'airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator', + 'S3ToRedshiftTransfer': 'airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator', + }, + 'slack_operator': { + 'SlackAPIOperator': 'airflow.providers.slack.operators.slack.SlackAPIOperator', + 'SlackAPIPostOperator': 'airflow.providers.slack.operators.slack.SlackAPIPostOperator', + }, + 'sql': { + 'BaseSQLOperator': 'airflow.providers.common.sql.operators.sql.BaseSQLOperator', + 'BranchSQLOperator': 'airflow.providers.common.sql.operators.sql.BranchSQLOperator', + 'SQLCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', + 'SQLColumnCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLColumnCheckOperator', + 'SQLIntervalCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', + 'SQLTableCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLTableCheckOperator', + 'SQLThresholdCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator', + 'SQLValueCheckOperator': 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', + '_convert_to_float_if_possible': ( + 'airflow.providers.common.sql.operators.sql._convert_to_float_if_possible' + ), + 'parse_boolean': 'airflow.providers.common.sql.operators.sql.parse_boolean', + }, + 'sql_branch_operator': { + 'BranchSQLOperator': 'airflow.providers.common.sql.operators.sql.BranchSQLOperator', + 'BranchSqlOperator': 'airflow.providers.common.sql.operators.sql.BranchSQLOperator', + }, + 'sqlite_operator': { + 'SqliteOperator': 'airflow.providers.sqlite.operators.sqlite.SqliteOperator', + }, + 'subdag_operator': { + 'SkippedStatePropagationOptions': 'airflow.operators.subdag.SkippedStatePropagationOptions', + 'SubDagOperator': 'airflow.operators.subdag.SubDagOperator', + }, +} + +add_deprecated_classes(__deprecated_classes, __name__) diff --git a/airflow/operators/bash_operator.py b/airflow/operators/bash_operator.py deleted file mode 100644 index c9435e465aacf..0000000000000 --- a/airflow/operators/bash_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.bash`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.bash import BashOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.bash`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/branch_operator.py b/airflow/operators/branch_operator.py deleted file mode 100644 index 03131a8b14b1a..0000000000000 --- a/airflow/operators/branch_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.branch`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.branch import BaseBranchOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.branch`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/check_operator.py b/airflow/operators/check_operator.py deleted file mode 100644 index 14cdce3ce8d71..0000000000000 --- a/airflow/operators/check_operator.py +++ /dev/null @@ -1,99 +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. - -"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.operators.sql import ( - SQLCheckOperator, - SQLIntervalCheckOperator, - SQLThresholdCheckOperator, - SQLValueCheckOperator, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.operators.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class CheckOperator(SQLCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) - - -class IntervalCheckOperator(SQLIntervalCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) - - -class ThresholdCheckOperator(SQLThresholdCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) - - -class ValueCheckOperator(SQLValueCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/dagrun_operator.py b/airflow/operators/dagrun_operator.py deleted file mode 100644 index 44b1fbbfb0b0b..0000000000000 --- a/airflow/operators/dagrun_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.trigger_dagrun`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.trigger_dagrun import TriggerDagRunLink, TriggerDagRunOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.trigger_dagrun`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/docker_operator.py b/airflow/operators/docker_operator.py deleted file mode 100644 index 408c8871a369f..0000000000000 --- a/airflow/operators/docker_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.docker.operators.docker`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.docker.operators.docker import DockerOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.docker.operators.docker`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/druid_check_operator.py b/airflow/operators/druid_check_operator.py deleted file mode 100644 index 6e103f54f8e06..0000000000000 --- a/airflow/operators/druid_check_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.druid.operators.druid_check import DruidCheckOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.operators.sql` module.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/dummy.py b/airflow/operators/dummy.py deleted file mode 100644 index 23f0bce9857c0..0000000000000 --- a/airflow/operators/dummy.py +++ /dev/null @@ -1,46 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.empty`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.empty import EmptyOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.empty`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class DummyOperator(EmptyOperator): - """This class is deprecated. Please use `airflow.operators.empty.EmptyOperator`.""" - - @property - def inherits_from_dummy_operator(self): - return True - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. Please use `airflow.operators.empty.EmptyOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - self.inherits_from_empty_operator = self.inherits_from_dummy_operator - super().__init__(**kwargs) diff --git a/airflow/operators/dummy_operator.py b/airflow/operators/dummy_operator.py deleted file mode 100644 index cc791336bddfc..0000000000000 --- a/airflow/operators/dummy_operator.py +++ /dev/null @@ -1,41 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.empty`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.empty import EmptyOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.empty`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class DummyOperator(EmptyOperator): - """This class is deprecated. Please use `airflow.operators.empty.EmptyOperator`.""" - - def __init__(self, *args, **kwargs): - warnings.warn( - """This class is deprecated. Please use `airflow.operators.empty.EmptyOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(*args, **kwargs) diff --git a/airflow/operators/email_operator.py b/airflow/operators/email_operator.py deleted file mode 100644 index c88c23d7063fe..0000000000000 --- a/airflow/operators/email_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.email`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.email import EmailOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.email`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/gcs_to_s3.py b/airflow/operators/gcs_to_s3.py deleted file mode 100644 index 90d258d8b8b72..0000000000000 --- a/airflow/operators/gcs_to_s3.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.transfers.gcs_to_s3`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.transfers.gcs_to_s3 import GCSToS3Operator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.transfers.gcs_to_s3`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/google_api_to_s3_transfer.py b/airflow/operators/google_api_to_s3_transfer.py deleted file mode 100644 index 82425c122af8c..0000000000000 --- a/airflow/operators/google_api_to_s3_transfer.py +++ /dev/null @@ -1,51 +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. -""" -This module is deprecated. -Please use `airflow.providers.amazon.aws.transfers.google_api_to_s3`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.transfers.google_api_to_s3`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class GoogleApiToS3Transfer(GoogleApiToS3Operator): - """This class is deprecated. - - Please use: - `airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - "This class is deprecated. " - "Please use " - "`airflow.providers.amazon.aws.transfers." - "google_api_to_s3_transfer.GoogleApiToS3Operator`.", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/hive_operator.py b/airflow/operators/hive_operator.py deleted file mode 100644 index 3d0bc875b7a3f..0000000000000 --- a/airflow/operators/hive_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.operators.hive`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.operators.hive import HiveOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.operators.hive`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/hive_stats_operator.py b/airflow/operators/hive_stats_operator.py deleted file mode 100644 index 2bde99bbddc5c..0000000000000 --- a/airflow/operators/hive_stats_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.operators.hive_stats`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.operators.hive_stats import HiveStatsCollectionOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.operators.hive_stats`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/hive_to_druid.py b/airflow/operators/hive_to_druid.py deleted file mode 100644 index 52782fa5ed647..0000000000000 --- a/airflow/operators/hive_to_druid.py +++ /dev/null @@ -1,50 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.apache.druid.transfers.hive_to_druid`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.druid.transfers.hive_to_druid`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class HiveToDruidTransfer(HiveToDruidOperator): - """This class is deprecated. - - Please use: - `airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/hive_to_mysql.py b/airflow/operators/hive_to_mysql.py deleted file mode 100644 index d4db82607553b..0000000000000 --- a/airflow/operators/hive_to_mysql.py +++ /dev/null @@ -1,50 +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. -""" -This module is deprecated. -Please use `airflow.providers.apache.hive.transfers.hive_to_mysql`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.transfers.hive_to_mysql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class HiveToMySqlTransfer(HiveToMySqlOperator): - """This class is deprecated. - - Please use: - `airflow.providers.apache.hive.transfers.hive_to_mysql.HiveToMySqlOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.apache.hive.transfers.hive_to_mysql.HiveToMySqlOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/hive_to_samba_operator.py b/airflow/operators/hive_to_samba_operator.py deleted file mode 100644 index 86883edefbe23..0000000000000 --- a/airflow/operators/hive_to_samba_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.transfers.hive_to_samba`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.transfers.hive_to_samba import HiveToSambaOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.transfers.hive_to_samba`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/http_operator.py b/airflow/operators/http_operator.py deleted file mode 100644 index 3a0ecb9f13c07..0000000000000 --- a/airflow/operators/http_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.http.operators.http`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.http.operators.http import SimpleHttpOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.http.operators.http`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/jdbc_operator.py b/airflow/operators/jdbc_operator.py deleted file mode 100644 index eb47f5ea4aa07..0000000000000 --- a/airflow/operators/jdbc_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.jdbc.operators.jdbc`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.jdbc.operators.jdbc import JdbcOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.jdbc.operators.jdbc`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/latest_only_operator.py b/airflow/operators/latest_only_operator.py deleted file mode 100644 index 6a2392b244d09..0000000000000 --- a/airflow/operators/latest_only_operator.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.latest_only`""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.latest_only import LatestOnlyOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.latest_only`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/mssql_operator.py b/airflow/operators/mssql_operator.py deleted file mode 100644 index 704bc6dae8c1f..0000000000000 --- a/airflow/operators/mssql_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.microsoft.mssql.operators.mssql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.microsoft.mssql.operators.mssql import MsSqlOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.microsoft.mssql.operators.mssql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/mssql_to_hive.py b/airflow/operators/mssql_to_hive.py deleted file mode 100644 index c40690c4fe38a..0000000000000 --- a/airflow/operators/mssql_to_hive.py +++ /dev/null @@ -1,50 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.apache.hive.transfers.mssql_to_hive`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.transfers.mssql_to_hive`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class MsSqlToHiveTransfer(MsSqlToHiveOperator): - """This class is deprecated. - - Please use: - `airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/mysql_operator.py b/airflow/operators/mysql_operator.py deleted file mode 100644 index f7423fec29a35..0000000000000 --- a/airflow/operators/mysql_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.mysql.operators.mysql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.mysql.operators.mysql import MySqlOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.mysql.operators.mysql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/mysql_to_hive.py b/airflow/operators/mysql_to_hive.py deleted file mode 100644 index 6a8e948928f99..0000000000000 --- a/airflow/operators/mysql_to_hive.py +++ /dev/null @@ -1,45 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.transfers.mysql_to_hive`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.transfers.mysql_to_hive`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class MySqlToHiveTransfer(MySqlToHiveOperator): - """ - This class is deprecated. - Please use `airflow.providers.apache.hive.transfers.mysql_to_hive.MySqlToHiveOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.apache.hive.transfers.mysql_to_hive.MySqlToHiveOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/oracle_operator.py b/airflow/operators/oracle_operator.py deleted file mode 100644 index a25f63750e221..0000000000000 --- a/airflow/operators/oracle_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.oracle.operators.oracle`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.oracle.operators.oracle import OracleOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.oracle.operators.oracle`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/papermill_operator.py b/airflow/operators/papermill_operator.py deleted file mode 100644 index 1772d4103c50d..0000000000000 --- a/airflow/operators/papermill_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.papermill.operators.papermill`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.papermill.operators.papermill import PapermillOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.papermill.operators.papermill`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/pig_operator.py b/airflow/operators/pig_operator.py deleted file mode 100644 index 9e02730c78c17..0000000000000 --- a/airflow/operators/pig_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.pig.operators.pig`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.pig.operators.pig import PigOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.pig.operators.pig`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/postgres_operator.py b/airflow/operators/postgres_operator.py deleted file mode 100644 index 917d018f1c230..0000000000000 --- a/airflow/operators/postgres_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.postgres.operators.postgres`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.postgres.operators.postgres import Mapping, PostgresOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.postgres.operators.postgres`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/presto_check_operator.py b/airflow/operators/presto_check_operator.py deleted file mode 100644 index d24b4395e4726..0000000000000 --- a/airflow/operators/presto_check_operator.py +++ /dev/null @@ -1,85 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.operators.sql import ( - SQLCheckOperator, - SQLIntervalCheckOperator, - SQLValueCheckOperator, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.operators.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class PrestoCheckOperator(SQLCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) - - -class PrestoIntervalCheckOperator(SQLIntervalCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """ - This class is deprecated.l - Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`. - """, - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) - - -class PrestoValueCheckOperator(SQLValueCheckOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """ - This class is deprecated.l - Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`. - """, - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/presto_to_mysql.py b/airflow/operators/presto_to_mysql.py deleted file mode 100644 index 9a179b54c50c5..0000000000000 --- a/airflow/operators/presto_to_mysql.py +++ /dev/null @@ -1,50 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.mysql.transfers.presto_to_mysql`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.mysql.transfers.presto_to_mysql import PrestoToMySqlOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.mysql.transfers.presto_to_mysql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class PrestoToMySqlTransfer(PrestoToMySqlOperator): - """This class is deprecated. - - Please use: - `airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/python_operator.py b/airflow/operators/python_operator.py deleted file mode 100644 index 02031f4677cbd..0000000000000 --- a/airflow/operators/python_operator.py +++ /dev/null @@ -1,34 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.python`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.python import ( # noqa - BranchPythonOperator, - PythonOperator, - PythonVirtualenvOperator, - ShortCircuitOperator, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.python`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/redshift_to_s3_operator.py b/airflow/operators/redshift_to_s3_operator.py deleted file mode 100644 index 8a0f70924dd9a..0000000000000 --- a/airflow/operators/redshift_to_s3_operator.py +++ /dev/null @@ -1,49 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.amazon.aws.transfers.redshift_to_s3`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.transfers.redshift_to_s3`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class RedshiftToS3Transfer(RedshiftToS3Operator): - """ - This class is deprecated. - Please use: :class:`airflow.providers.amazon.aws.transfers.redshift_to_s3.RedshiftToS3Operator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.amazon.aws.transfers.redshift_to_s3.RedshiftToS3Operator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/s3_file_transform_operator.py b/airflow/operators/s3_file_transform_operator.py deleted file mode 100644 index 7a43aa39beb64..0000000000000 --- a/airflow/operators/s3_file_transform_operator.py +++ /dev/null @@ -1,32 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.amazon.aws.operators.s3_file_transform` -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.operators.s3_file_transform import S3FileTransformOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.operators.s3_file_transform`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/s3_to_hive_operator.py b/airflow/operators/s3_to_hive_operator.py deleted file mode 100644 index 50dd11e95cabf..0000000000000 --- a/airflow/operators/s3_to_hive_operator.py +++ /dev/null @@ -1,45 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.transfers.s3_to_hive`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.transfers.s3_to_hive`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class S3ToHiveTransfer(S3ToHiveOperator): - """ - This class is deprecated. - Please use `airflow.providers.apache.hive.transfers.s3_to_hive.S3ToHiveOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.apache.hive.transfers.s3_to_hive.S3ToHiveOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/s3_to_redshift_operator.py b/airflow/operators/s3_to_redshift_operator.py deleted file mode 100644 index 4679c3d6c8651..0000000000000 --- a/airflow/operators/s3_to_redshift_operator.py +++ /dev/null @@ -1,50 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.amazon.aws.transfers.s3_to_redshift`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.transfers.s3_to_redshift`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class S3ToRedshiftTransfer(S3ToRedshiftOperator): - """This class is deprecated. - - Please use: - `airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use - `airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator`.""", - RemovedInAirflow3Warning, - stacklevel=3, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/slack_operator.py b/airflow/operators/slack_operator.py deleted file mode 100644 index 9e46cd2a2c69d..0000000000000 --- a/airflow/operators/slack_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.slack.operators.slack`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.slack.operators.slack import SlackAPIOperator, SlackAPIPostOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.slack.operators.slack`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/sql.py b/airflow/operators/sql.py deleted file mode 100644 index a10f04766e9d8..0000000000000 --- a/airflow/operators/sql.py +++ /dev/null @@ -1,38 +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. -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.operators.sql import ( # noqa - BaseSQLOperator, - BranchSQLOperator, - SQLCheckOperator, - SQLColumnCheckOperator, - SQLIntervalCheckOperator, - SQLTableCheckOperator, - SQLThresholdCheckOperator, - SQLValueCheckOperator, - _convert_to_float_if_possible, - parse_boolean, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.operators.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/sql_branch_operator.py b/airflow/operators/sql_branch_operator.py deleted file mode 100644 index 897a35cbe6f74..0000000000000 --- a/airflow/operators/sql_branch_operator.py +++ /dev/null @@ -1,43 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.operators.sql import BranchSQLOperator - -warnings.warn( - "This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) - - -class BranchSqlOperator(BranchSQLOperator): - """ - This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.BranchSQLOperator`. - """ - - def __init__(self, **kwargs): - warnings.warn( - """This class is deprecated. - Please use `airflow.providers.common.sql.operators.sql.BranchSQLOperator`.""", - RemovedInAirflow3Warning, - stacklevel=2, - ) - super().__init__(**kwargs) diff --git a/airflow/operators/sqlite_operator.py b/airflow/operators/sqlite_operator.py deleted file mode 100644 index 4966a22017902..0000000000000 --- a/airflow/operators/sqlite_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.sqlite.operators.sqlite`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.sqlite.operators.sqlite import SqliteOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.sqlite.operators.sqlite`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/operators/subdag_operator.py b/airflow/operators/subdag_operator.py deleted file mode 100644 index 322999c7a738e..0000000000000 --- a/airflow/operators/subdag_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.operators.subdag`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.operators.subdag import SkippedStatePropagationOptions, SubDagOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.operators.subdag`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/__init__.py b/airflow/sensors/__init__.py index d3a60b4f79c97..761ad0a05130a 100644 --- a/airflow/sensors/__init__.py +++ b/airflow/sensors/__init__.py @@ -16,4 +16,56 @@ # specific language governing permissions and limitations # under the License. # +# fmt: off """Sensors.""" +from airflow.utils.deprecation_tools import add_deprecated_classes + +__deprecated_classes = { + 'base_sensor_operator': { + 'BaseSensorOperator': 'airflow.sensors.base.BaseSensorOperator', + }, + 'date_time_sensor': { + 'DateTimeSensor': 'airflow.sensors.date_time.DateTimeSensor', + }, + 'external_task_sensor': { + 'ExternalTaskMarker': 'airflow.sensors.external_task.ExternalTaskMarker', + 'ExternalTaskSensor': 'airflow.sensors.external_task.ExternalTaskSensor', + 'ExternalTaskSensorLink': 'airflow.sensors.external_task.ExternalTaskSensorLink', + }, + 'hdfs_sensor': { + 'HdfsSensor': 'airflow.providers.apache.hdfs.sensors.hdfs.HdfsSensor', + }, + 'hive_partition_sensor': { + 'HivePartitionSensor': 'airflow.providers.apache.hive.sensors.hive_partition.HivePartitionSensor', + }, + 'http_sensor': { + 'HttpSensor': 'airflow.providers.http.sensors.http.HttpSensor', + }, + 'metastore_partition_sensor': { + 'MetastorePartitionSensor': ( + 'airflow.providers.apache.hive.sensors.metastore_partition.MetastorePartitionSensor' + ), + }, + 'named_hive_partition_sensor': { + 'NamedHivePartitionSensor': ( + 'airflow.providers.apache.hive.sensors.named_hive_partition.NamedHivePartitionSensor' + ), + }, + 's3_key_sensor': { + 'S3KeySensor': 'airflow.providers.amazon.aws.sensors.s3.S3KeySensor', + }, + 'sql': { + 'SqlSensor': 'airflow.providers.common.sql.sensors.sql.SqlSensor', + }, + 'sql_sensor': { + 'SqlSensor': 'airflow.providers.common.sql.sensors.sql.SqlSensor', + }, + 'time_delta_sensor': { + 'TimeDeltaSensor': 'airflow.sensors.time_delta.TimeDeltaSensor', + }, + 'web_hdfs_sensor': { + 'WebHdfsSensor': 'airflow.providers.apache.hdfs.sensors.web_hdfs.WebHdfsSensor', + }, +} + +add_deprecated_classes(__deprecated_classes, __name__) diff --git a/airflow/sensors/base_sensor_operator.py b/airflow/sensors/base_sensor_operator.py deleted file mode 100644 index 1ad050eeb5367..0000000000000 --- a/airflow/sensors/base_sensor_operator.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.sensors.base`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.sensors.base import BaseSensorOperator # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.sensors.base`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/date_time_sensor.py b/airflow/sensors/date_time_sensor.py deleted file mode 100644 index 1ee8bda4c873a..0000000000000 --- a/airflow/sensors/date_time_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.sensors.date_time`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.sensors.date_time import DateTimeSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.sensors.date_time`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/external_task_sensor.py b/airflow/sensors/external_task_sensor.py deleted file mode 100644 index 4bb0901a7170f..0000000000000 --- a/airflow/sensors/external_task_sensor.py +++ /dev/null @@ -1,33 +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. -"""This module is deprecated. Please use :mod:`airflow.sensors.external_task`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.sensors.external_task import ( # noqa - ExternalTaskMarker, - ExternalTaskSensor, - ExternalTaskSensorLink, -) - -warnings.warn( - "This module is deprecated. Please use `airflow.sensors.external_task`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/hdfs_sensor.py b/airflow/sensors/hdfs_sensor.py deleted file mode 100644 index 7f95259216def..0000000000000 --- a/airflow/sensors/hdfs_sensor.py +++ /dev/null @@ -1,30 +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. - -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hdfs.sensors.hdfs`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hdfs.sensors.hdfs import HdfsSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hdfs.sensors.hdfs`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/hive_partition_sensor.py b/airflow/sensors/hive_partition_sensor.py deleted file mode 100644 index 0b4599740e0e7..0000000000000 --- a/airflow/sensors/hive_partition_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.sensors.hive_partition`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.sensors.hive_partition import HivePartitionSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.sensors.hive_partition`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/http_sensor.py b/airflow/sensors/http_sensor.py deleted file mode 100644 index c14ae99b0e19d..0000000000000 --- a/airflow/sensors/http_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.http.sensors.http`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.http.sensors.http import HttpSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.http.sensors.http`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/metastore_partition_sensor.py b/airflow/sensors/metastore_partition_sensor.py deleted file mode 100644 index 693afba4b1b11..0000000000000 --- a/airflow/sensors/metastore_partition_sensor.py +++ /dev/null @@ -1,32 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.apache.hive.sensors.metastore_partition`. -""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.sensors.metastore_partition import MetastorePartitionSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.sensors.metastore_partition`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/named_hive_partition_sensor.py b/airflow/sensors/named_hive_partition_sensor.py deleted file mode 100644 index cdae0f7ae39b6..0000000000000 --- a/airflow/sensors/named_hive_partition_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hive.sensors.named_hive_partition`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hive.sensors.named_hive_partition import NamedHivePartitionSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hive.sensors.named_hive_partition`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/s3_key_sensor.py b/airflow/sensors/s3_key_sensor.py deleted file mode 100644 index 450f769b9872d..0000000000000 --- a/airflow/sensors/s3_key_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.sensors.s3_key`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.s3_key`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/sql.py b/airflow/sensors/sql.py deleted file mode 100644 index 79ccab040bad7..0000000000000 --- a/airflow/sensors/sql.py +++ /dev/null @@ -1,27 +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. -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.sensors.sql import SqlSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.sensors.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/sql_sensor.py b/airflow/sensors/sql_sensor.py deleted file mode 100644 index 22ea90dc26f26..0000000000000 --- a/airflow/sensors/sql_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.sensors.sql`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.common.sql.sensors.sql import SqlSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.common.sql.sensors.sql`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/time_delta_sensor.py b/airflow/sensors/time_delta_sensor.py deleted file mode 100644 index 02f03b78e5b1f..0000000000000 --- a/airflow/sensors/time_delta_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.sensors.time_delta`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.sensors.time_delta import TimeDeltaSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.sensors.time_delta`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/sensors/web_hdfs_sensor.py b/airflow/sensors/web_hdfs_sensor.py deleted file mode 100644 index 6a046ad4a75a0..0000000000000 --- a/airflow/sensors/web_hdfs_sensor.py +++ /dev/null @@ -1,29 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.apache.hdfs.sensors.web_hdfs`.""" - -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.apache.hdfs.sensors.web_hdfs import WebHdfsSensor # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.apache.hdfs.sensors.web_hdfs`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/__init__.py b/airflow/utils/log/__init__.py index 217e5db960782..cbcdd76f6f38d 100644 --- a/airflow/utils/log/__init__.py +++ b/airflow/utils/log/__init__.py @@ -15,3 +15,34 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# fmt: off +from airflow.utils.deprecation_tools import add_deprecated_classes + +__deprecated_classes = { + 'cloudwatch_task_handler': { + 'CloudwatchTaskHandler': ( + 'airflow.providers.amazon.aws.log.cloudwatch_task_handler.CloudwatchTaskHandler' + ), + }, + 'es_task_handler': { + 'ElasticsearchTaskHandler': ( + 'airflow.providers.elasticsearch.log.es_task_handler.ElasticsearchTaskHandler' + ), + }, + 'gcs_task_handler': { + 'GCSTaskHandler': 'airflow.providers.google.cloud.log.gcs_task_handler.GCSTaskHandler', + }, + 's3_task_handler': { + 'S3TaskHandler': 'airflow.providers.amazon.aws.log.s3_task_handler.S3TaskHandler', + }, + 'stackdriver_task_handler': { + 'StackdriverTaskHandler': ( + 'airflow.providers.google.cloud.log.stackdriver_task_handler.StackdriverTaskHandler' + ), + }, + 'wasb_task_handler': { + 'WasbTaskHandler': 'airflow.providers.microsoft.azure.log.wasb_task_handler.WasbTaskHandler', + }, +} + +add_deprecated_classes(__deprecated_classes, __name__) diff --git a/airflow/utils/log/cloudwatch_task_handler.py b/airflow/utils/log/cloudwatch_task_handler.py deleted file mode 100644 index 1d09c984a50b1..0000000000000 --- a/airflow/utils/log/cloudwatch_task_handler.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.log.cloudwatch_task_handler`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.log.cloudwatch_task_handler import CloudwatchTaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.log.cloudwatch_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/es_task_handler.py b/airflow/utils/log/es_task_handler.py deleted file mode 100644 index 6008e072f475f..0000000000000 --- a/airflow/utils/log/es_task_handler.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.elasticsearch.log.es_task_handler`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.elasticsearch.log.es_task_handler import ElasticsearchTaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.elasticsearch.log.es_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/gcs_task_handler.py b/airflow/utils/log/gcs_task_handler.py deleted file mode 100644 index 41a9e5718e40b..0000000000000 --- a/airflow/utils/log/gcs_task_handler.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.google.cloud.log.gcs_task_handler`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.google.cloud.log.gcs_task_handler import GCSTaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.google.cloud.log.gcs_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/s3_task_handler.py b/airflow/utils/log/s3_task_handler.py deleted file mode 100644 index f71856f576ee3..0000000000000 --- a/airflow/utils/log/s3_task_handler.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.amazon.aws.log.s3_task_handler`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.amazon.aws.log.s3_task_handler import S3TaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.amazon.aws.log.s3_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/stackdriver_task_handler.py b/airflow/utils/log/stackdriver_task_handler.py deleted file mode 100644 index b891c4b18ce0e..0000000000000 --- a/airflow/utils/log/stackdriver_task_handler.py +++ /dev/null @@ -1,30 +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. -""" -This module is deprecated. -Please use :mod:`airflow.providers.google.cloud.log.stackdriver_task_handler`. -""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.google.cloud.log.stackdriver_task_handler import StackdriverTaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.google.cloud.log.stackdriver_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/airflow/utils/log/wasb_task_handler.py b/airflow/utils/log/wasb_task_handler.py deleted file mode 100644 index 5f08dc574b2b5..0000000000000 --- a/airflow/utils/log/wasb_task_handler.py +++ /dev/null @@ -1,28 +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. -"""This module is deprecated. Please use :mod:`airflow.providers.microsoft.azure.log.wasb_task_handler`.""" -import warnings - -from airflow.exceptions import RemovedInAirflow3Warning -from airflow.providers.microsoft.azure.log.wasb_task_handler import WasbTaskHandler # noqa - -warnings.warn( - "This module is deprecated. Please use `airflow.providers.microsoft.azure.log.wasb_task_handler`.", - RemovedInAirflow3Warning, - stacklevel=2, -) diff --git a/tests/always/test_deprecations.py b/tests/always/test_deprecations.py deleted file mode 100644 index 075d31256897d..0000000000000 --- a/tests/always/test_deprecations.py +++ /dev/null @@ -1,114 +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. - -import importlib -import warnings -from inspect import isabstract -from unittest import mock - -import pytest - -from airflow.models.baseoperator import BaseOperator -from tests.deprecated_classes import ALL, RENAMED_ALL - - -class TestDeprecations: - @staticmethod - def assert_warning(msg: str, warnings): - error = f"Text '{msg}' not in warnings" - assert any(msg in str(w) for w in warnings), error - - def assert_is_subclass(self, clazz, other): - assert issubclass(clazz, other), f"{clazz} is not subclass of {other}" - - def assert_proper_import(self, old_resource, new_resource): - new_path, _, _ = new_resource.rpartition(".") - old_path, _, _ = old_resource.rpartition(".") - with pytest.warns(DeprecationWarning) as warnings: - # Reload to see deprecation warning each time - importlib.reload(importlib.import_module(old_path)) - self.assert_warning(new_path, warnings) - - @staticmethod - def get_class_from_path(path_to_class, parent=False): - """ - :param path_to_class: the path to the class - :param parent: indicates if "path_to_class" arg is super class - """ - - path, _, class_name = path_to_class.rpartition(".") - module = importlib.import_module(path) - class_ = getattr(module, class_name) - - if isabstract(class_) and not parent: - class_name = f"Mock({class_.__name__})" - - attributes = {a: mock.MagicMock() for a in class_.__abstractmethods__} - - new_class = type(class_name, (class_,), attributes) - return new_class - return class_ - - @pytest.mark.parametrize("new_module, old_module", RENAMED_ALL) - def test_is_class_deprecated(self, new_module, old_module): - deprecation_warning_msg = "This class is deprecated." - with pytest.warns(DeprecationWarning, match=deprecation_warning_msg) as warnings: - old_module_class = self.get_class_from_path(old_module) - warnings.clear() - with mock.patch(f"{new_module}.__init__") as init_mock: - init_mock.return_value = None - klass = old_module_class() - if isinstance(klass, BaseOperator): - # In case of operators we are validating that proper stacklevel - # is used (=3) - assert len(warnings) >= 1 - # For nicer error reporting from pytest, create a static - # list of filenames - files = [warning.filename for warning in warnings] - assert __file__ in files, old_module - init_mock.assert_called_once() - - @pytest.mark.parametrize("parent_class_path, sub_class_path", ALL) - def test_is_subclass(self, parent_class_path, sub_class_path): - with mock.patch(f"{parent_class_path}.__init__"), warnings.catch_warnings(record=True): - parent_class_path = self.get_class_from_path(parent_class_path, parent=True) - sub_class_path = self.get_class_from_path(sub_class_path) - self.assert_is_subclass(sub_class_path, parent_class_path) - - @pytest.mark.parametrize("new_path, old_path", ALL) - def test_warning_on_import(self, new_path, old_path): - self.assert_proper_import(old_path, new_path) - - def test_no_redirect_to_deprecated_classes(self): - """ - When we have the following items: - new_A, old_B - old_B, old_C - - This will tell us to use new_A instead of old_B. - """ - all_classes_by_old = {old: new for new, old in ALL} - - for new, old in ALL: - # Using if statement allows us to create a developer-friendly message only when we need it. - # Otherwise, it wouldn't always be possible - KeyError - if new in all_classes_by_old: - raise AssertionError( - f'Deprecation "{old}" to "{new}" is incorrect. ' - f'Please use \"{all_classes_by_old[new]}\" instead of "{old}".' - ) diff --git a/tests/deprecated_classes.py b/tests/deprecated_classes.py deleted file mode 100644 index 63b6eb7f68f6b..0000000000000 --- a/tests/deprecated_classes.py +++ /dev/null @@ -1,390 +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. -HOOKS = [ - ( - "airflow.hooks.base.BaseHook", - "airflow.hooks.base_hook.BaseHook", - ), - ( - 'airflow.providers.apache.druid.hooks.druid.DruidHook', - 'airflow.hooks.druid_hook.DruidHook', - ), - ( - 'airflow.providers.apache.druid.hooks.druid.DruidDbApiHook', - 'airflow.hooks.druid_hook.DruidDbApiHook', - ), - ( - 'airflow.providers.apache.hdfs.hooks.hdfs.HDFSHookException', - 'airflow.hooks.hdfs_hook.HDFSHookException', - ), - ( - 'airflow.providers.apache.hdfs.hooks.hdfs.HDFSHook', - 'airflow.hooks.hdfs_hook.HDFSHook', - ), - ( - 'airflow.providers.apache.hive.hooks.hive.HiveMetastoreHook', - 'airflow.hooks.hive_hooks.HiveMetastoreHook', - ), - ( - 'airflow.providers.apache.hive.hooks.hive.HiveCliHook', - 'airflow.hooks.hive_hooks.HiveCliHook', - ), - ( - 'airflow.providers.apache.hive.hooks.hive.HiveServer2Hook', - 'airflow.hooks.hive_hooks.HiveServer2Hook', - ), - ( - 'airflow.providers.apache.pig.hooks.pig.PigCliHook', - 'airflow.hooks.pig_hook.PigCliHook', - ), - ( - 'airflow.providers.apache.hdfs.hooks.webhdfs.WebHDFSHook', - 'airflow.hooks.webhdfs_hook.WebHDFSHook', - ), - ( - 'airflow.providers.docker.hooks.docker.DockerHook', - 'airflow.hooks.docker_hook.DockerHook', - ), - ( - 'airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook', - 'airflow.hooks.mssql_hook.MsSqlHook', - ), - ( - 'airflow.providers.mysql.hooks.mysql.MySqlHook', - 'airflow.hooks.mysql_hook.MySqlHook', - ), - ( - 'airflow.providers.oracle.hooks.oracle.OracleHook', - 'airflow.hooks.oracle_hook.OracleHook', - ), - ( - 'airflow.providers.postgres.hooks.postgres.PostgresHook', - 'airflow.hooks.postgres_hook.PostgresHook', - ), - ( - 'airflow.providers.presto.hooks.presto.PrestoHook', - 'airflow.hooks.presto_hook.PrestoHook', - ), - ( - 'airflow.providers.samba.hooks.samba.SambaHook', - 'airflow.hooks.samba_hook.SambaHook', - ), - ( - 'airflow.providers.sqlite.hooks.sqlite.SqliteHook', - 'airflow.hooks.sqlite_hook.SqliteHook', - ), - ( - 'airflow.providers.slack.hooks.slack.SlackHook', - 'airflow.hooks.slack_hook.SlackHook', - ), - ( - 'airflow.providers.zendesk.hooks.zendesk.ZendeskHook', - 'airflow.hooks.zendesk_hook.ZendeskHook', - ), - ( - 'airflow.providers.http.hooks.http.HttpHook', - 'airflow.hooks.http_hook.HttpHook', - ), - ( - 'airflow.providers.jdbc.hooks.jdbc.JdbcHook', - 'airflow.hooks.jdbc_hook.JdbcHook', - ), - ( - "airflow.providers.atlassian.jira.hooks.jira.JiraHook", - "airflow.providers.jira.hooks.jira.JiraHook", - ), -] - -OPERATORS = [ - ( - 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', - 'airflow.operators.druid_check_operator.DruidCheckOperator', - ), - ( - 'airflow.providers.apache.hive.operators.hive.HiveOperator', - 'airflow.operators.hive_operator.HiveOperator', - ), - ( - 'airflow.providers.apache.hive.operators.hive_stats.HiveStatsCollectionOperator', - 'airflow.operators.hive_stats_operator.HiveStatsCollectionOperator', - ), - ( - 'airflow.providers.apache.pig.operators.pig.PigOperator', - 'airflow.operators.pig_operator.PigOperator', - ), - ( - 'airflow.operators.branch.BaseBranchOperator', - 'airflow.operators.branch_operator.BaseBranchOperator', - ), - ( - 'airflow.operators.bash.BashOperator', - 'airflow.operators.bash_operator.BashOperator', - ), - ( - 'airflow.providers.docker.operators.docker.DockerOperator', - 'airflow.operators.docker_operator.DockerOperator', - ), - ( - 'airflow.providers.microsoft.mssql.operators.mssql.MsSqlOperator', - 'airflow.operators.mssql_operator.MsSqlOperator', - ), - ( - 'airflow.providers.mysql.operators.mysql.MySqlOperator', - 'airflow.operators.mysql_operator.MySqlOperator', - ), - ( - 'airflow.providers.oracle.operators.oracle.OracleOperator', - 'airflow.operators.oracle_operator.OracleOperator', - ), - ( - 'airflow.providers.papermill.operators.papermill.PapermillOperator', - 'airflow.operators.papermill_operator.PapermillOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', - 'airflow.operators.presto_check_operator.PrestoCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', - 'airflow.operators.presto_check_operator.PrestoIntervalCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', - 'airflow.operators.presto_check_operator.PrestoValueCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLCheckOperator', - 'airflow.operators.check_operator.CheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator', - 'airflow.operators.check_operator.IntervalCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLValueCheckOperator', - 'airflow.operators.check_operator.ValueCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator', - 'airflow.operators.check_operator.ThresholdCheckOperator', - ), - ( - 'airflow.providers.common.sql.operators.sql.BranchSQLOperator', - 'airflow.operators.sql_branch_operator.BranchSqlOperator', - ), - ( - 'airflow.operators.python.BranchPythonOperator', - 'airflow.operators.python_operator.BranchPythonOperator', - ), - ( - 'airflow.operators.python.PythonOperator', - 'airflow.operators.python_operator.PythonOperator', - ), - ( - 'airflow.operators.python.ShortCircuitOperator', - 'airflow.operators.python_operator.ShortCircuitOperator', - ), - ( - 'airflow.operators.python.PythonVirtualenvOperator', - 'airflow.operators.python_operator.PythonVirtualenvOperator', - ), - ( - 'airflow.providers.sqlite.operators.sqlite.SqliteOperator', - 'airflow.operators.sqlite_operator.SqliteOperator', - ), - ( - 'airflow.providers.slack.operators.slack.SlackAPIPostOperator', - 'airflow.operators.slack_operator.SlackAPIPostOperator', - ), - ( - 'airflow.providers.slack.operators.slack.SlackAPIOperator', - 'airflow.operators.slack_operator.SlackAPIOperator', - ), - ( - 'airflow.operators.email.EmailOperator', - 'airflow.operators.email_operator.EmailOperator', - ), - ( - 'airflow.providers.http.operators.http.SimpleHttpOperator', - 'airflow.operators.http_operator.SimpleHttpOperator', - ), - ( - 'airflow.providers.jdbc.operators.jdbc.JdbcOperator', - 'airflow.operators.jdbc_operator.JdbcOperator', - ), - ( - 'airflow.providers.postgres.operators.postgres.PostgresOperator', - 'airflow.operators.postgres_operator.PostgresOperator', - ), - ( - "airflow.operators.latest_only.LatestOnlyOperator", - "airflow.operators.latest_only_operator.LatestOnlyOperator", - ), - ( - "airflow.operators.trigger_dagrun.TriggerDagRunOperator", - "airflow.operators.dagrun_operator.TriggerDagRunOperator", - ), - ( - "airflow.operators.subdag.SubDagOperator", - "airflow.operators.subdag_operator.SubDagOperator", - ), - ( - "airflow.operators.empty.EmptyOperator", - "airflow.operators.dummy_operator.DummyOperator", - ), - ( - "airflow.operators.empty.EmptyOperator", - "airflow.operators.dummy.DummyOperator", - ), - ( - "airflow.providers.atlassian.jira.operators.jira.JiraOperator", - "airflow.providers.jira.operators.jira.JiraOperator", - ), -] - -SENSORS = [ - ( - "airflow.sensors.base.BaseSensorOperator", - "airflow.sensors.base_sensor_operator.BaseSensorOperator", - ), - ( - "airflow.sensors.date_time.DateTimeSensor", - "airflow.sensors.date_time_sensor.DateTimeSensor", - ), - ( - "airflow.sensors.time_delta.TimeDeltaSensor", - "airflow.sensors.time_delta_sensor.TimeDeltaSensor", - ), - ( - 'airflow.providers.apache.hive.sensors.hive_partition.HivePartitionSensor', - 'airflow.sensors.hive_partition_sensor.HivePartitionSensor', - ), - ( - 'airflow.providers.apache.hive.sensors.metastore_partition.MetastorePartitionSensor', - 'airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor', - ), - ( - 'airflow.providers.apache.hive.sensors.named_hive_partition.NamedHivePartitionSensor', - 'airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor', - ), - ( - 'airflow.providers.apache.hdfs.sensors.web_hdfs.WebHdfsSensor', - 'airflow.sensors.web_hdfs_sensor.WebHdfsSensor', - ), - ( - 'airflow.providers.apache.hdfs.sensors.hdfs.HdfsSensor', - 'airflow.sensors.hdfs_sensor.HdfsSensor', - ), - ( - 'airflow.providers.amazon.aws.sensors.s3.S3KeySensor', - 'airflow.sensors.s3_key_sensor.S3KeySensor', - ), - ( - 'airflow.providers.http.sensors.http.HttpSensor', - 'airflow.sensors.http_sensor.HttpSensor', - ), - ( - "airflow.providers.atlassian.jira.sensors.jira.JiraSensor", - "airflow.providers.jira.sensors.jira.JiraSensor", - ), - ( - "airflow.providers.atlassian.jira.sensors.jira.JiraTicketSensor", - "airflow.providers.jira.sensors.jira.JiraTicketSensor", - ), -] - -TRANSFERS = [ - ( - 'airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSToS3Operator', - 'airflow.operators.gcs_to_s3.GCSToS3Operator', - ), - ( - 'airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator', - 'airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Transfer', - ), - ( - 'airflow.providers.amazon.aws.transfers.redshift_to_s3.RedshiftToS3Operator', - 'airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer', - ), - ( - 'airflow.providers.amazon.aws.transfers.s3_to_redshift.S3ToRedshiftOperator', - 'airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer', - ), - ( - 'airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator', - 'airflow.operators.hive_to_druid.HiveToDruidTransfer', - ), - ( - 'airflow.providers.apache.hive.transfers.hive_to_mysql.HiveToMySqlOperator', - 'airflow.operators.hive_to_mysql.HiveToMySqlTransfer', - ), - ( - 'airflow.providers.apache.hive.transfers.mysql_to_hive.MySqlToHiveOperator', - 'airflow.operators.mysql_to_hive.MySqlToHiveTransfer', - ), - ( - 'airflow.providers.apache.hive.transfers.s3_to_hive.S3ToHiveOperator', - 'airflow.operators.s3_to_hive_operator.S3ToHiveTransfer', - ), - ( - 'airflow.providers.apache.hive.transfers.hive_to_samba.HiveToSambaOperator', - 'airflow.operators.hive_to_samba_operator.HiveToSambaOperator', - ), - ( - 'airflow.providers.apache.hive.transfers.mssql_to_hive.MsSqlToHiveOperator', - 'airflow.operators.mssql_to_hive.MsSqlToHiveTransfer', - ), - ( - 'airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator', - 'airflow.operators.presto_to_mysql.PrestoToMySqlTransfer', - ), -] - -LOGS = [ - ( - "airflow.providers.amazon.aws.log.s3_task_handler.S3TaskHandler", - "airflow.utils.log.s3_task_handler.S3TaskHandler", - ), - ( - 'airflow.providers.amazon.aws.log.cloudwatch_task_handler.CloudwatchTaskHandler', - 'airflow.utils.log.cloudwatch_task_handler.CloudwatchTaskHandler', - ), - ( - 'airflow.providers.elasticsearch.log.es_task_handler.ElasticsearchTaskHandler', - 'airflow.utils.log.es_task_handler.ElasticsearchTaskHandler', - ), - ( - "airflow.providers.google.cloud.log.stackdriver_task_handler.StackdriverTaskHandler", - "airflow.utils.log.stackdriver_task_handler.StackdriverTaskHandler", - ), - ( - "airflow.providers.google.cloud.log.gcs_task_handler.GCSTaskHandler", - "airflow.utils.log.gcs_task_handler.GCSTaskHandler", - ), - ( - "airflow.providers.microsoft.azure.log.wasb_task_handler.WasbTaskHandler", - "airflow.utils.log.wasb_task_handler.WasbTaskHandler", - ), -] - -ALL = HOOKS + OPERATORS + SENSORS + TRANSFERS + LOGS - -RENAMED_ALL = [ - (old_class, new_class) - for old_class, new_class in HOOKS + OPERATORS + SENSORS - if old_class.rpartition(".")[2] != new_class.rpartition(".")[2] -] diff --git a/tests/operators/test_dummy.py b/tests/operators/test_dummy.py deleted file mode 100644 index ab9538f8f41ba..0000000000000 --- a/tests/operators/test_dummy.py +++ /dev/null @@ -1,25 +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. - -import pytest - - -def test_deprecation_warnings_generated(): - from airflow.operators.dummy import DummyOperator - - with pytest.warns(expected_warning=DeprecationWarning): - DummyOperator(task_id='my_task') diff --git a/tests/providers/common/sql/operators/test_sql.py b/tests/providers/common/sql/operators/test_sql.py index 8eb95e1c0daaa..81ecba860158c 100644 --- a/tests/providers/common/sql/operators/test_sql.py +++ b/tests/providers/common/sql/operators/test_sql.py @@ -639,7 +639,7 @@ def test_sql_branch_operator_postgres(self): ) branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, ignore_ti_state=True) - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_branch_single_value_with_dag_run(self, mock_get_db_hook): """Check BranchSQLOperator branch operation""" branch_op = BranchSQLOperator( @@ -679,7 +679,7 @@ def test_branch_single_value_with_dag_run(self, mock_get_db_hook): else: raise ValueError(f"Invalid task id {ti.task_id} found!") - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_branch_true_with_dag_run(self, mock_get_db_hook): """Check BranchSQLOperator branch operation""" branch_op = BranchSQLOperator( @@ -720,7 +720,7 @@ def test_branch_true_with_dag_run(self, mock_get_db_hook): else: raise ValueError(f"Invalid task id {ti.task_id} found!") - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_branch_false_with_dag_run(self, mock_get_db_hook): """Check BranchSQLOperator branch operation""" branch_op = BranchSQLOperator( @@ -760,7 +760,7 @@ def test_branch_false_with_dag_run(self, mock_get_db_hook): else: raise ValueError(f"Invalid task id {ti.task_id} found!") - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_branch_list_with_dag_run(self, mock_get_db_hook): """Checks if the BranchSQLOperator supports branching off to a list of tasks.""" branch_op = BranchSQLOperator( @@ -803,7 +803,7 @@ def test_branch_list_with_dag_run(self, mock_get_db_hook): else: raise ValueError(f"Invalid task id {ti.task_id} found!") - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_invalid_query_result_with_dag_run(self, mock_get_db_hook): """Check BranchSQLOperator branch operation""" branch_op = BranchSQLOperator( @@ -833,7 +833,7 @@ def test_invalid_query_result_with_dag_run(self, mock_get_db_hook): with pytest.raises(AirflowException): branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_with_skip_in_branch_downstream_dependencies(self, mock_get_db_hook): """Test SQL Branch with skipping all downstream dependencies""" branch_op = BranchSQLOperator( @@ -874,7 +874,7 @@ def test_with_skip_in_branch_downstream_dependencies(self, mock_get_db_hook): else: raise ValueError(f"Invalid task id {ti.task_id} found!") - @mock.patch("airflow.operators.sql.BaseSQLOperator.get_db_hook") + @mock.patch("airflow.providers.common.sql.operators.sql.BaseSQLOperator.get_db_hook") def test_with_skip_in_branch_downstream_dependencies2(self, mock_get_db_hook): """Test skipping downstream dependency for false condition""" branch_op = BranchSQLOperator( diff --git a/tests/serialization/test_dag_serialization.py b/tests/serialization/test_dag_serialization.py index 3d50a19f8092f..378b016b59aa2 100644 --- a/tests/serialization/test_dag_serialization.py +++ b/tests/serialization/test_dag_serialization.py @@ -2201,43 +2201,3 @@ def x(arg1, arg2, arg3): "op_kwargs": {"arg1": [1, 2, {"a": "b"}]}, "retry_delay": timedelta(seconds=30), } - - -@pytest.mark.filterwarnings("ignore::DeprecationWarning") -@pytest.mark.parametrize( - "is_inherit", - [ - True, - False, - ], -) -def test_dummy_operator_serde(is_inherit): - """ - Test to verify that when user uses custom DummyOperator with inherits_from_dummy_operator - we will have _is_empty in serialized operator. - """ - - # In this test we should NOT switch the DummyOperator to EmptyOperator. - # This test can be removed in Airflow 3.0 as EmptyOperator will be removed then. - from airflow.operators.dummy import DummyOperator - - class MyDummyOperator(DummyOperator): - inherits_from_dummy_operator = is_inherit - - op = MyDummyOperator(task_id='my_task') - - serialized = SerializedBaseOperator.serialize(op) - - assert serialized == { - '_is_empty': is_inherit, - '_task_module': 'tests.serialization.test_dag_serialization', - '_task_type': 'MyDummyOperator', - 'downstream_task_ids': [], - "pool": "default_pool", - 'task_id': 'my_task', - 'ui_color': '#e8f7e4', - 'ui_fgcolor': '#000', - 'template_ext': [], - 'template_fields': [], - 'template_fields_renderers': {}, - }