bugraoz93 commented on a change in pull request #19377:
URL: https://github.com/apache/airflow/pull/19377#discussion_r747624569
##########
File path: airflow/providers/facebook/ads/hooks/ads.py
##########
@@ -118,11 +122,32 @@ def bulk_facebook_report(
:param sleep_time: Time to sleep when async call is happening
:type sleep_time: int
- :return: Facebook Ads API response, converted to Facebook Ads Row
objects
- :rtype: List[AdsInsights]
+ :return: Facebook Ads API response,
+ converted to Facebook Ads Row objects regarding given Account ID
type
+ :rtype: List[AdsInsights] or Dict[str, List[AdsInsights]]
"""
api = self._get_service()
- ad_account = AdAccount(api.get_default_account_id(), api=api)
+ if self.is_backward:
+ return self._facebook_report(
+ account_id=self.facebook_ads_config["account_id"],
+ api=api,
+ params=params,
+ fields=fields,
+ sleep_time=sleep_time,
+ )
Review comment:
Hi @uranusjr, In this context, backward means it is returning the same
as the old version which is List[AdsInsights]. In the current version, Facebook
Ads Hook only supports one account_id (string) at the time meaning if you have
multiple account_id (array|list) for ads, you have to maintain multiple
Facebook Ads Connection in the Airflow. To support multiple account_id in the
same Facebook Ads Connection, I corollated both account_id and the list of
AdsInsights with returning Dict[str, List[AdsInsights]] but this was a breaking
change since the return type was changed. After that, I updated the logic with
this check if the account_id in the provided Facebook Connection as a string
(single account_id), it returns the same format which is List[AdsInsights] and
in the operator this situation also handled. If the multiple account_id is
provided in the Facebook Ads Connection as an array, then the check provide to
return Dict[str, List[AdsInsights]] which every report correlated
with account_id to export them regarding account_id. For that reason, I called
that check as is_backward which provides the check of the old connection format
to work as it is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]