From 06dfc2536c0bcddec478ff61cdc8677d9bc64435 Mon Sep 17 00:00:00 2001 From: eladkal <45845474+eladkal@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:32:06 +0300 Subject: [PATCH] Remove deprecated `params` from google operators (#23230) * `GoogleDisplayVideo360CreateReportOperator`, `FacebookAdsReportToGcsOperator`: remove `params` --- airflow/providers/google/CHANGELOG.rst | 4 ++++ .../cloud/transfers/facebook_ads_to_gcs.py | 16 ---------------- .../operators/display_video.py | 18 +----------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/airflow/providers/google/CHANGELOG.rst b/airflow/providers/google/CHANGELOG.rst index a83d1ac11cf2..ad85c5d662e1 100644 --- a/airflow/providers/google/CHANGELOG.rst +++ b/airflow/providers/google/CHANGELOG.rst @@ -34,6 +34,10 @@ Breaking changes For more information, see `Deprecation and sunset `_ and `Upgrading to the newest version `_ +* ``GoogleDisplayVideo360CreateReportOperator``: remove ``params``. Please use ``parameters`` + +* ``FacebookAdsReportToGcsOperator``: remove ``params``. Please use ``parameters`` + * ``GoogleDriveToGCSOperator``: Remove ``destination_bucket`` and ``destination_object``. Please use ``bucket_name`` and ``object_name``. * ``GCSObjectsWtihPrefixExistenceSensor`` removed. Please use ``GCSObjectsWithPrefixExistenceSensor``. diff --git a/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py b/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py index db5ec43df790..4222b8ad2bef 100644 --- a/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +++ b/airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py @@ -18,7 +18,6 @@ """This module contains Facebook Ad Reporting to GCS operators.""" import csv import tempfile -import warnings from enum import Enum from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union @@ -66,9 +65,6 @@ class FacebookAdsReportToGcsOperator(BaseOperator): it will use the Facebook business SDK default version. :param fields: List of fields that is obtained from Facebook. Found in AdsInsights.Field class. https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0 - :param params: Parameters that determine the query for Facebook. This keyword is deprecated, - please use `parameters` keyword to pass the parameters. - https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0 :param parameters: Parameters that determine the query for Facebook https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0 :param gzip: Option to compress local file or file data for upload @@ -100,7 +96,6 @@ def __init__( bucket_name: str, object_name: str, fields: List[str], - params: Optional[Dict[str, Any]] = None, parameters: Optional[Dict[str, Any]] = None, gzip: bool = False, upload_as_account: bool = False, @@ -122,17 +117,6 @@ def __init__( self.upload_as_account = upload_as_account self.impersonation_chain = impersonation_chain - if params is None and parameters is None: - raise AirflowException("Argument ['parameters'] is required") - if params and parameters is None: - # TODO: Remove in provider version 6.0 - warnings.warn( - "Please use 'parameters' instead of 'params'", - DeprecationWarning, - stacklevel=2, - ) - self.parameters = params - def execute(self, context: 'Context'): service = FacebookAdsReportingHook( facebook_conn_id=self.facebook_conn_id, api_version=self.api_version diff --git a/airflow/providers/google/marketing_platform/operators/display_video.py b/airflow/providers/google/marketing_platform/operators/display_video.py index e7cb901509ab..de102a14d8f3 100644 --- a/airflow/providers/google/marketing_platform/operators/display_video.py +++ b/airflow/providers/google/marketing_platform/operators/display_video.py @@ -21,7 +21,6 @@ import shutil import tempfile import urllib.request -import warnings from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from urllib.parse import urlparse @@ -322,9 +321,6 @@ class GoogleDisplayVideo360RunReportOperator(BaseOperator): `https://developers.google.com/bid-manager/v1/queries/runquery` :param report_id: Report ID to run. - :param params: Parameters for running a report as described here: - https://developers.google.com/bid-manager/v1/queries/runquery. Please note that this - keyword is deprecated, please use `parameters` keyword to pass the parameters. :param parameters: Parameters for running a report as described here: https://developers.google.com/bid-manager/v1/queries/runquery :param api_version: The version of the api that will be requested for example 'v3'. @@ -352,7 +348,6 @@ def __init__( self, *, report_id: str, - params: Optional[Dict[str, Any]] = None, parameters: Optional[Dict[str, Any]] = None, api_version: str = "v1", gcp_conn_id: str = "google_cloud_default", @@ -368,17 +363,6 @@ def __init__( self.parameters = parameters self.impersonation_chain = impersonation_chain - if params is None and parameters is None: - raise AirflowException("Argument ['parameters'] is required") - if params and parameters is None: - # TODO: Remove in provider version 6.0 - warnings.warn( - "Please use 'parameters' instead of 'params'", - DeprecationWarning, - stacklevel=2, - ) - self.parameters = params - def execute(self, context: 'Context') -> None: hook = GoogleDisplayVideo360Hook( gcp_conn_id=self.gcp_conn_id, @@ -387,7 +371,7 @@ def execute(self, context: 'Context') -> None: impersonation_chain=self.impersonation_chain, ) self.log.info( - "Running report %s with the following params:\n %s", + "Running report %s with the following parameters:\n %s", self.report_id, self.parameters, )