Skip to content

Commit

Permalink
Move all "old" SQL operators to common.sql providers (#25350)
Browse files Browse the repository at this point in the history
Previously, in #24836 we moved Hooks and added some new operators to the
common.sql package. Now we are salso moving the operators
and sensors to common.sql.
  • Loading branch information
potiuk committed Jul 29, 2022
1 parent 5e423f5 commit acab8f5
Show file tree
Hide file tree
Showing 26 changed files with 1,424 additions and 1,404 deletions.
24 changes: 13 additions & 11 deletions airflow/operators/check_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,34 @@
# specific language governing permissions and limitations
# under the License.

"""This module is deprecated. Please use :mod:`airflow.operators.sql`."""
"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`."""

import warnings

from airflow.operators.sql import (
from airflow.providers.common.sql.operators.sql import (
SQLCheckOperator,
SQLIntervalCheckOperator,
SQLThresholdCheckOperator,
SQLValueCheckOperator,
)

warnings.warn(
"This module is deprecated. Please use `airflow.operators.sql`.", DeprecationWarning, stacklevel=2
"This module is deprecated. Please use `airflow.providers.common.sql.operators.sql`.",
DeprecationWarning,
stacklevel=2,
)


class CheckOperator(SQLCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.operators.sql.SQLCheckOperator`.""",
Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -51,13 +53,13 @@ def __init__(self, **kwargs):
class IntervalCheckOperator(SQLIntervalCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLIntervalCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.operators.sql.SQLIntervalCheckOperator`.""",
Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`.""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -67,13 +69,13 @@ def __init__(self, **kwargs):
class ThresholdCheckOperator(SQLThresholdCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLThresholdCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.operators.sql.SQLThresholdCheckOperator`.""",
Please use `airflow.providers.common.sql.operators.sql.SQLThresholdCheckOperator`.""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -83,13 +85,13 @@ def __init__(self, **kwargs):
class ValueCheckOperator(SQLValueCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLValueCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.operators.sql.SQLValueCheckOperator`.""",
Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`.""",
DeprecationWarning,
stacklevel=2,
)
Expand Down
4 changes: 2 additions & 2 deletions airflow/operators/druid_check_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# 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.operators.druid_check`."""
"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`."""

import warnings

from airflow.providers.apache.druid.operators.druid_check import DruidCheckOperator # noqa

warnings.warn(
"This module is deprecated. Please use `airflow.operators.sql.SQLCheckOperator`.",
"This module is deprecated. Please use `airflow.providers.common.sql.operators.sql` module.",
DeprecationWarning,
stacklevel=2,
)
24 changes: 15 additions & 9 deletions airflow/operators/presto_check_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,33 @@
# 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.sql`."""
"""This module is deprecated. Please use :mod:`airflow.providers.common.sql.operators.sql`."""

import warnings

from airflow.operators.sql import SQLCheckOperator, SQLIntervalCheckOperator, SQLValueCheckOperator
from airflow.providers.common.sql.operators.sql import (
SQLCheckOperator,
SQLIntervalCheckOperator,
SQLValueCheckOperator,
)

warnings.warn(
"This module is deprecated. Please use `airflow.operators.sql`.", DeprecationWarning, stacklevel=2
"This module is deprecated. Please use `airflow.providers.common.sql.operators.sql`.",
DeprecationWarning,
stacklevel=2,
)


class PrestoCheckOperator(SQLCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.operators.sql.SQLCheckOperator`.""",
Please use `airflow.providers.common.sql.operators.sql.SQLCheckOperator`.""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -45,14 +51,14 @@ def __init__(self, **kwargs):
class PrestoIntervalCheckOperator(SQLIntervalCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLIntervalCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""
This class is deprecated.l
Please use `airflow.operators.sql.SQLIntervalCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLIntervalCheckOperator`.
""",
DeprecationWarning,
stacklevel=2,
Expand All @@ -63,14 +69,14 @@ def __init__(self, **kwargs):
class PrestoValueCheckOperator(SQLValueCheckOperator):
"""
This class is deprecated.
Please use `airflow.operators.sql.SQLValueCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`.
"""

def __init__(self, **kwargs):
warnings.warn(
"""
This class is deprecated.l
Please use `airflow.operators.sql.SQLValueCheckOperator`.
Please use `airflow.providers.common.sql.operators.sql.SQLValueCheckOperator`.
""",
DeprecationWarning,
stacklevel=2,
Expand Down

0 comments on commit acab8f5

Please sign in to comment.