FacebookAdsReportToGcsOperator

Google

Fetches the results from the Facebook Ads API as desired in the params Converts and saves the data as a temporary JSON file Uploads the JSON to Google Cloud Storage

View Source

Last Updated: May. 7, 2021

Access Instructions

Install the Google provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

bucketstrThe GCS bucket to upload to
objstrGCS path to save the object. Must be the full file path (ex. path/to/file.txt)
gcp_conn_idstrAirflow Google Cloud connection ID
facebook_conn_idstrAirflow Facebook Ads connection ID
api_versionstrThe version of Facebook API. Default to v6.0
fieldsList[str]List of fields that is obtained from Facebook. Found in AdsInsights.Field class. https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
paramsDict[str, Any]Parameters that determine the query for Facebook https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
sleep_timeintTime to sleep when async call is happening
gzipboolOption to compress local file or file data for upload
impersonation_chainUnion[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).

Documentation

Fetches the results from the Facebook Ads API as desired in the params Converts and saves the data as a temporary JSON file Uploads the JSON to Google Cloud Storage

See also

For more information on the Facebook Ads API, take a look at the API docs: https://developers.facebook.com/docs/marketing-apis/

See also

For more information on the Facebook Ads Python SDK, take a look at the docs: https://github.com/facebook/facebook-python-business-sdk

See also

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

Was this page helpful?