From 27e6ee064e47b910e2b813e6dc6c49a74769a594 Mon Sep 17 00:00:00 2001 From: oleh Date: Mon, 7 Feb 2022 09:22:20 +0200 Subject: [PATCH 1/4] 6557 Add `primary_key` for all insights streams --- .../connectors/source-facebook-marketing/Dockerfile | 2 +- .../source_facebook_marketing/streams.py | 2 +- docs/integrations/sources/facebook-marketing.md | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile b/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile index a61c3d8d57b98..5cc5eade30a17 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile +++ b/airbyte-integrations/connectors/source-facebook-marketing/Dockerfile @@ -12,5 +12,5 @@ RUN pip install . ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.2.31 +LABEL io.airbyte.version=0.2.32 LABEL io.airbyte.name=airbyte/source-facebook-marketing diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py index fe0013a8966ea..0d9fae2593f99 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py +++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py @@ -297,7 +297,7 @@ class AdsInsights(FBMarketingIncrementalStream): """doc: https://developers.facebook.com/docs/marketing-api/insights""" cursor_field = "date_start" - primary_key = None + primary_key = ["account_id", "campaign_id", "adset_id", "ad_id"] ALL_ACTION_ATTRIBUTION_WINDOWS = [ "1d_click", diff --git a/docs/integrations/sources/facebook-marketing.md b/docs/integrations/sources/facebook-marketing.md index 88d3a98f16f9f..78fc60516f96e 100644 --- a/docs/integrations/sources/facebook-marketing.md +++ b/docs/integrations/sources/facebook-marketing.md @@ -12,10 +12,10 @@ This Source is capable of syncing the following tables and their data: * [AdSets](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign#fields) -* [Ads](https://developers.facebook.com/docs/marketing-api/reference/adgroup#fields) +* [Ads](https://developers.facebook.com/docs/marketing-api/reference/adgroup#fields) * [AdCreatives](https://developers.facebook.com/docs/marketing-api/reference/ad-creative#fields) -* [Campaigns](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group#fields) -* [AdInsights](https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/) +* [Campaigns](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group#fields) +* [AdInsights](https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/) You can segment the AdInsights table into parts based on the following information. Each part will be synced as a separate table if normalization is enabled: @@ -31,7 +31,7 @@ For more information, see the [Facebook Insights API documentation. ](https://de 1. Click `Authenticate your Facebook Marketing account`. 2. Enter your Account ID. Learn how to find it are [here](https://www.facebook.com/business/help/1492627900875762). -3. Enter a start date and your Insights settings. +3. Enter a start date and your Insights settings. 4. You're done. ## Getting Started \(Airbyte Open-Source\) @@ -96,6 +96,7 @@ As a summary, custom insights allows to replicate only some fields, resulting in | Version | Date | Pull Request | Subject | | :--- | :--- | :--- | :--- | +| 0.2.32 | 2022-01-07 | [10137](https://github.com/airbytehq/airbyte/pull/10137) | Add `primary_key` for all insights streams. | | 0.2.31 | 2021-12-28 | [](https://github.com/airbytehq/airbyte/pull/) | Fixed videos stream format field incorrect type | | 0.2.30 | 2021-12-20 | [8962](https://github.com/airbytehq/airbyte/pull/8962) | Added `asset_feed_spec` field to `ad creatives` stream | | 0.2.29 | 2021-12-17 | [8649](https://github.com/airbytehq/airbyte/pull/8649) | Retrive ad_creatives image as data encoded | From d634a9428d21ac03b30d367de29f6f3f5bfca49b Mon Sep 17 00:00:00 2001 From: oleh Date: Mon, 7 Feb 2022 09:27:33 +0200 Subject: [PATCH 2/4] 6557 Update docs --- docs/integrations/sources/facebook-marketing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/integrations/sources/facebook-marketing.md b/docs/integrations/sources/facebook-marketing.md index 78fc60516f96e..b69cdd806426c 100644 --- a/docs/integrations/sources/facebook-marketing.md +++ b/docs/integrations/sources/facebook-marketing.md @@ -96,8 +96,8 @@ As a summary, custom insights allows to replicate only some fields, resulting in | Version | Date | Pull Request | Subject | | :--- | :--- | :--- | :--- | -| 0.2.32 | 2022-01-07 | [10137](https://github.com/airbytehq/airbyte/pull/10137) | Add `primary_key` for all insights streams. | -| 0.2.31 | 2021-12-28 | [](https://github.com/airbytehq/airbyte/pull/) | Fixed videos stream format field incorrect type | +| 0.2.32 | 2022-01-07 | [10138](https://github.com/airbytehq/airbyte/pull/10138) | Add `primary_key` for all insights streams. | +| 0.2.31 | 2021-12-29 | [9138](https://github.com/airbytehq/airbyte/pull/9138) | Fixed videos stream format field incorrect type | | 0.2.30 | 2021-12-20 | [8962](https://github.com/airbytehq/airbyte/pull/8962) | Added `asset_feed_spec` field to `ad creatives` stream | | 0.2.29 | 2021-12-17 | [8649](https://github.com/airbytehq/airbyte/pull/8649) | Retrive ad_creatives image as data encoded | | 0.2.28 | 2021-12-13 | [8742](https://github.com/airbytehq/airbyte/pull/8742) | Fix for schema generation related to "breakdown" fields | From 5894fd90892b214bcc29e205cfc4996f0add0e15 Mon Sep 17 00:00:00 2001 From: oleh Date: Mon, 7 Feb 2022 10:18:31 +0200 Subject: [PATCH 3/4] 6557 Fix integration_tests --- .../source-facebook-marketing/integration_tests/test_streams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/test_streams.py b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/test_streams.py index c363a4adf9593..45c87622e0e55 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/test_streams.py +++ b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/test_streams.py @@ -52,7 +52,7 @@ def test_streams_with_include_deleted(self, stream_name, deleted_id, config_with assert deleted_records, f"{stream_name} stream should have deleted records returned" assert is_specific_deleted_pulled, f"{stream_name} stream should have a deleted record with id={deleted_id}" - @pytest.mark.parametrize("stream_name, deleted_num", [("ads", 2), ("campaigns", 1), ("ad_sets", 1)]) + @pytest.mark.parametrize("stream_name, deleted_num", [("ads", 2), ("campaigns", 3), ("ad_sets", 1)]) def test_streams_with_include_deleted_and_state(self, stream_name, deleted_num, config_with_include_deleted, configured_catalog, state): """Should ignore state because of include_deleted enabled""" catalog = self.slice_catalog(configured_catalog, {stream_name}) From 80a07aac336c0cf459905bb4288eea4e5c1df59c Mon Sep 17 00:00:00 2001 From: oleh Date: Mon, 7 Feb 2022 10:58:31 +0200 Subject: [PATCH 4/4] 6557 Bump connector's version --- .../init/src/main/resources/seed/source_definitions.yaml | 2 +- airbyte-config/init/src/main/resources/seed/source_specs.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 d4507b26c2824..e10d784c22502 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -196,7 +196,7 @@ - name: Facebook Marketing sourceDefinitionId: e7778cfc-e97c-4458-9ecb-b4f2bba8946c dockerRepository: airbyte/source-facebook-marketing - dockerImageTag: 0.2.31 + dockerImageTag: 0.2.32 documentationUrl: https://docs.airbyte.io/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 14605995c6e5e..9ec51abce0b68 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -1618,7 +1618,7 @@ supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] -- dockerImage: "airbyte/source-facebook-marketing:0.2.31" +- dockerImage: "airbyte/source-facebook-marketing:0.2.32" spec: documentationUrl: "https://docs.airbyte.io/integrations/sources/facebook-marketing" changelogUrl: "https://docs.airbyte.io/integrations/sources/facebook-marketing"