airflow.providers.google.ads.transfers.ads_to_gcs

Module Contents

Classes

GoogleAdsToGcsOperator

Fetches the daily results from the Google Ads API for 1-n clients

class airflow.providers.google.ads.transfers.ads_to_gcs.GoogleAdsToGcsOperator(*, client_ids, query, attributes, bucket, obj, gcp_conn_id='google_cloud_default', google_ads_conn_id='google_ads_default', page_size=10000, gzip=False, impersonation_chain=None, api_version=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Fetches the daily results from the Google Ads API for 1-n clients Converts and saves the data as a temporary CSV file Uploads the CSV to Google Cloud Storage

See also

For more information on the Google Ads API, take a look at the API docs: https://developers.google.com/google-ads/api/docs/start

See also

For more information on how to use this operator, take a look at the guide: Google Ads to GCS

Parameters
  • client_ids (List[str]) – Google Ads client IDs to query

  • query (str) – Google Ads Query Language API query

  • attributes (List[str]) – List of Google Ads Row attributes to extract

  • bucket (str) – The GCS bucket to upload to

  • obj (str) – GCS path to save the object. Must be the full file path (ex. path/to/file.txt)

  • gcp_conn_id (str) – Airflow Google Cloud connection ID

  • google_ads_conn_id (str) – Airflow Google Ads connection ID

  • page_size (int) – The number of results per API page request. Max 10,000

  • gzip (bool) – Option to compress local file or file data for upload

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

  • api_version (Optional[str]) – Optional Google Ads API version to use.

template_fields :Sequence[str] = ['client_ids', 'query', 'attributes', 'bucket', 'obj', 'impersonation_chain'][source]
execute(self, context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?