diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index 22e6fab492a5..54596ac043ae 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -488,7 +488,7 @@ - name: Facebook Marketing sourceDefinitionId: e7778cfc-e97c-4458-9ecb-b4f2bba8946c dockerRepository: airbyte/source-facebook-marketing - dockerImageTag: 0.2.82 + dockerImageTag: 0.2.83 documentationUrl: https://docs.airbyte.com/integrations/sources/facebook-marketing icon: facebook.svg sourceType: api diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index 6fef1da5a6ca..06440193f6a6 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -3524,7 +3524,7 @@ supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] -- dockerImage: "airbyte/source-facebook-marketing:0.2.82" +- dockerImage: "airbyte/source-facebook-marketing:0.2.83" spec: documentationUrl: "https://docs.airbyte.com/integrations/sources/facebook-marketing" changelogUrl: "https://docs.airbyte.com/integrations/sources/facebook-marketing" diff --git a/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile b/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile index 82f065cbf77b..03e57ca90bfa 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile +++ b/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile @@ -13,5 +13,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.2.82 +LABEL io.airbyte.version=0.2.83 LABEL io.airbyte.name=airbyte/source-facebook-marketing diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_streams.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_streams.py index d24929d5d164..7a1a8f628e74 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_streams.py +++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_streams.py @@ -15,7 +15,6 @@ from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer from cached_property import cached_property from facebook_business.adobjects.abstractobject import AbstractObject -from facebook_business.adobjects.adimage import AdImage from facebook_business.api import FacebookAdsApiBatch, FacebookRequest, FacebookResponse from .common import deep_merge @@ -243,6 +242,9 @@ def _state_filter(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]: """Don't have classic cursor filtering""" return {} + def get_record_deleted_status(self, record) -> bool: + return False + def read_records( self, sync_mode: SyncMode, @@ -261,7 +263,7 @@ def read_records( record_cursor_value = pendulum.parse(record[self.cursor_field]) if self._cursor_value and record_cursor_value < self._cursor_value: break - if not self._include_deleted and record[AdImage.Field.status] == AdImage.Status.deleted: + if not self._include_deleted and self.get_record_deleted_status(record): continue self._max_cursor_value = self._max_cursor_value or record_cursor_value diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py index 4af8d8392c05..4d7d397983ef 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py +++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py @@ -12,6 +12,7 @@ from cached_property import cached_property from facebook_business.adobjects.abstractobject import AbstractObject from facebook_business.adobjects.adaccount import AdAccount as FBAdAccount +from facebook_business.adobjects.adimage import AdImage from facebook_business.adobjects.user import User from .base_insight_streams import AdsInsights @@ -145,13 +146,14 @@ def _state_filter(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]: return {"since": since.int_timestamp} -class Videos(FBMarketingIncrementalStream): +class Videos(FBMarketingReversedIncrementalStream): """See: https://developers.facebook.com/docs/marketing-api/reference/video""" entity_prefix = "video" def list_objects(self, params: Mapping[str, Any]) -> Iterable: - return self._api.account.get_ad_videos(params=params) + # Remove filtering as it is not working for this stream since 2023-01-13 + return self._api.account.get_ad_videos(params=params, fields=self.fields) class AdAccount(FBMarketingStream): @@ -194,6 +196,9 @@ class Images(FBMarketingReversedIncrementalStream): def list_objects(self, params: Mapping[str, Any]) -> Iterable: return self._api.account.get_ad_images(params=params, fields=self.fields) + def get_record_deleted_status(self, record) -> bool: + return record[AdImage.Field.status] == AdImage.Status.deleted + class AdsInsightsAgeAndGender(AdsInsights): breakdowns = ["age", "gender"] diff --git a/docs/integrations/sources/facebook-marketing.md b/docs/integrations/sources/facebook-marketing.md index 4e5d041ce5f8..bd21d47fa2c5 100644 --- a/docs/integrations/sources/facebook-marketing.md +++ b/docs/integrations/sources/facebook-marketing.md @@ -133,6 +133,7 @@ Please be informed that the connector uses the `lookback_window` parameter to pe | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 0.2.83 | 2023-01-13 | [21149](https://github.com/airbytehq/airbyte/pull/21149) | Videos stream remove filtering | | 0.2.82 | 2023-01-09 | [21149](https://github.com/airbytehq/airbyte/pull/21149) | Fix AdAccount schema | | 0.2.81 | 2023-01-05 | [21057](https://github.com/airbytehq/airbyte/pull/21057) | Remove unsupported fields from request | | 0.2.80 | 2022-12-21 | [20736](https://github.com/airbytehq/airbyte/pull/20736) | Fix update next cursor |