This module contains Facebook Ads Reporting hooks

Module Contents



Available options for facebook async task status


Hook for the Facebook Ads API


Bases: enum.Enum

Available options for facebook async task status

COMPLETED = Job Completed[source]
STARTED = Job Started[source]
RUNNING = Job Running[source]
FAILED = Job Failed[source]
SKIPPED = Job Skipped[source]
class, api_version=None)[source]

Bases: airflow.hooks.base.BaseHook

Hook for the Facebook Ads API

See also

For more information on the Facebook Ads API, take a look at the API docs:

  • facebook_conn_id (str) -- Airflow Facebook Ads connection ID

  • api_version (Optional[str]) -- The version of Facebook API. Default to None. If it is None, it will use the Facebook business SDK default version.

conn_name_attr = facebook_conn_id[source]
default_conn_name = facebook_default[source]
conn_type = facebook_social[source]
hook_name = Facebook Ads[source]

Checks whether provided account_id in the Facebook Ads Connection is provided as a list


Gets Facebook ads connection from meta db and sets facebook_ads_config attribute with returned config file

bulk_facebook_report(self, params, fields, sleep_time=5)[source]

Pulls data from the Facebook Ads API regarding Account ID with matching return type.

The return type and value depends on the account_id configuration. If the configuration is a str representing a single Account ID, the return value is the list of reports for that ID. If the configuration is a list of str representing multiple Account IDs, the return value is a dict of Account IDs and their respective list of reports.


Facebook Ads API response, converted to Facebook Ads Row objects regarding given Account ID type

Return type

List[AdsInsights] or Dict[str, List[AdsInsights]]

Was this entry helpful?