Skip to content

Commit

Permalink
Remove deprecated params from google operators (#23230)
Browse files Browse the repository at this point in the history
* `GoogleDisplayVideo360CreateReportOperator`, `FacebookAdsReportToGcsOperator`: remove `params`
  • Loading branch information
eladkal committed Apr 26, 2022
1 parent 37a7b27 commit 06dfc25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 33 deletions.
4 changes: 4 additions & 0 deletions airflow/providers/google/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Breaking changes
For more information, see `Deprecation and sunset <https://developers.google.com/google-ads/api/docs/sunset-dates>`_
and `Upgrading to the newest version <https://developers.google.com/google-ads/api/docs/version-migration>`_

* ``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``.
Expand Down
16 changes: 0 additions & 16 deletions airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'.
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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,
)
Expand Down

0 comments on commit 06dfc25

Please sign in to comment.