Skip to content

🐛 Source Facebook Marketing: Add statuses filters - #32449

Merged
Anatolii Yatsuk (tolik0) merged 24 commits into
airbytehq:masterfrom
SteppeChange:sivanou/source-facebook-marketing-statuses
Feb 20, 2024
Merged

Anatolii Yatsuk (tolik0) merged 24 commits into
airbytehq:masterfrom
SteppeChange:sivanou/source-facebook-marketing-statuses

Conversation

@iSINUS

@iSINUS Siarhei Ivanou (iSINUS) commented Nov 11, 2023 •

Copy link
Copy Markdown
Contributor

What

Add status filters to source connector Facebook Marketing for streams Campaigns, AdSets and Ads (#32421).
Remove option "include_deleted" as it from older versions of Marketing API and operates with not actual fields and values.

New config UI looks like:
image

How

Updated the specification and stream filtering. State migration was implemented to ensure no disruptions for users. The include_deleted option is now mapped to all possible statuses and is still retained in the stream status for backward compatibility.

Recommended reading order

  1. x.java
  2. y.python

🚨 User Impact 🚨

If user are interested in getting "deleted" stream data it is required to update configuration and set desired statuses ("ARCHIVED", "DELETED") per stream. To match the behaviour with include_deleted from the previous version, all possible statuses should be selected.
Previous version of code worked not really correctly (there is no field delivery_info by which it was filtered and statuses used in code were in lower case and not correct for current Marketing API version).
Incorrect current version call:
/adsets?filtering=[ { "field": "adset.delivery_info", "operator": "IN", "value": [ "paused" ] }]
New version call:
/adsets?filtering=[ { "field": "adset.effective_status", "operator": "IN", "value": [ "PAUSED" ] }]

@vercel

vercel Bot commented Nov 11, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 6:23pm

@CLAassistant

CLAassistant commented Nov 11, 2023 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@iSINUS Siarhei Ivanou (iSINUS) changed the title 🚨🚨 Add statuses filters to source connector Facebook Marketing 🚨🚨 Source Facebook Marketing: Add statuses filters Nov 11, 2023
@iSINUS
Siarhei Ivanou (iSINUS) marked this pull request as ready for review November 11, 2023 07:50
@iSINUS
Siarhei Ivanou (iSINUS) force-pushed the sivanou/source-facebook-marketing-statuses branch from e9daa94 to 4fc52c2 Compare November 11, 2023 07:52

@marcosmarxm M. Marx (marcosmarxm) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Siarhei Ivanou (@iSINUS) thanks for the contribution and patience. I'll run tests and return with any update during the week.

@iSINUS

Copy link
Copy Markdown
Contributor Author

Hi, M. Marx (@marcosmarxm)! Is there any update?

@iSINUS

Copy link
Copy Markdown
Contributor Author

Hi, M. Marx (@marcosmarxm)! Is there any update?

@marcosmarxm

Copy link
Copy Markdown
Contributor

I asked to the team make the final review. I'll ask again, sorry the delay Siarhei Ivanou (@iSINUS) !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need change fields to enum and follow to braking change procedure (M. Marx (@marcosmarxm))

if self._cursor_values:
result_state = {account_id: {self.cursor_field: cursor_value} for account_id, cursor_value in self._cursor_values.items()}
result_state["include_deleted"] = self._include_deleted
result_state["filter_statuses"] = self._filter_statuses

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need avoid braking change and if user has included_deleted parameter use it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main idea of the change is to avoid single option to do not process deleted and have specific statuses for streams.
So there will be no changes from our side.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the main idea, but for users who have already set up synchronization, this will be a breaking change, requiring them to reconfigure their connections.

We aim to avoid this inconvenience. Therefore, let's revise the logic so that if the include_deleted parameter exists, we will utilize the old logic. However, if the filter_statuses list is set up, we will exclusively use this list.

@iSINUS Siarhei Ivanou (iSINUS) Feb 8, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is breaking change - who do not need new functionality should stay on older version. I will not over-engineer for backward compatibility. The issue will be if both parameters are set, but filter_statuses exclude "DELETED" - it will require additional explanation to user (should we include deleted in such cases?) - not straight forward behaviour.

if self._cursor_values:
result_state = {account_id: {self.cursor_field: cursor_value} for account_id, cursor_value in self._cursor_values.items()}
result_state["include_deleted"] = self._include_deleted
result_state["filter_statuses"] = self._filter_statuses

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the main idea, but for users who have already set up synchronization, this will be a breaking change, requiring them to reconfigure their connections.

We aim to avoid this inconvenience. Therefore, let's revise the logic so that if the include_deleted parameter exists, we will utilize the old logic. However, if the filter_statuses list is set up, we will exclusively use this list.

@tolik0

Copy link
Copy Markdown
Contributor

Siarhei Ivanou (@iSINUS) Hi, could you grant me permission to push changes to your branch? I'd like to add my fixes and then merge your PR. Thanks!

@iSINUS

Copy link
Copy Markdown
Contributor Author

Siarhei Ivanou (@iSINUS) Hi, could you grant me permission to push changes to your branch? I'd like to add my fixes and then merge your PR. Thanks!

Anatolii Yatsuk (@tolik0) Hi! I have no rights to repo with branch, person who has is on vacation today. Will ask tomorrow. Thank you!

@iSINUS

Siarhei Ivanou (iSINUS) commented Feb 20, 2024 •

Copy link
Copy Markdown
Contributor Author

Siarhei Ivanou (@iSINUS) Hi, could you grant me permission to push changes to your branch? I'd like to add my fixes and then merge your PR. Thanks!

Anatolii Yatsuk (@tolik0) Done. Now you should have access.

Please, take into account that you have removed AdCreative status, but it is required - https://developers.facebook.com/docs/marketing-api/reference/ad-creative/
"status enum {ACTIVE, IN_PROCESS, WITH_ISSUES, DELETED} | The status of the creative. WITH_ISSUES and IN_PROCESS are available for 4.0 or higher"

@tolik0

Copy link
Copy Markdown
Contributor

Siarhei Ivanou (@iSINUS) Hello. The AdCreative endpoint doesn't support status filtering. Please check the docs: the Parameters block shows which fields can be used for filtering.

Status:  400\n  Response:\n    {\n      \"error\": {\n        \"message\": \"(#100) Filtering field 'adcreative.status' with operation 'in' is not supported\"

@iSINUS

Copy link
Copy Markdown
Contributor Author

Siarhei Ivanou (@iSINUS) Hello. The AdCreative endpoint doesn't support status filtering. Please check the docs: the Parameters block shows which fields can be used for filtering.

Status:  400\n  Response:\n    {\n      \"error\": {\n        \"message\": \"(#100) Filtering field 'adcreative.status' with operation 'in' is not supported\"

Anatolii Yatsuk (@tolik0) OK. Thank you.

@tolik0
Anatolii Yatsuk (tolik0) merged commit dd01ba3 into airbytehq:master Feb 20, 2024
@iSINUS
Siarhei Ivanou (iSINUS) deleted the sivanou/source-facebook-marketing-statuses branch February 21, 2024 05:30
@tolik0 Anatolii Yatsuk (tolik0) changed the title 🚨🚨 Source Facebook Marketing: Add statuses filters 🐛 Source Facebook Marketing: Add statuses filters Feb 21, 2024
Xiaohan Song (xiaohansong) pushed a commit that referenced this pull request Feb 27, 2024
Co-authored-by: Anatolii Yatsuk <tolikyatsuk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants