def generate_rows(self, dataset_schema=None, dataset_partitioning=None, partition_id=None, records_limit=-1): """ The main reading method. Returns a generator over the rows of the dataset (or partition) Each yielded row must be a dictionary, indexed by column name. The dataset schema and partitioning are given for information purpose. """ FacebookAdsApi.init(access_token=self.access_token, api_version='v3.3') params = { 'time_range': { 'since': self.date_start, 'until': self.date_stop }, 'breakdowns': self.breakdowns, 'level': self.level, 'time_increment': 1 } async_job = AdAccount(self.ad_account_id).get_insights_async( fields=self.fields, params=params) while not async_job.remote_read().get( "async_status") == 'Job Completed': time.sleep(1) resulting_adaccount_lines = async_job.get_result() for line in resulting_adaccount_lines: yield line.export_data()