feat(source-facebook-marketing): Make account_ids optional with auto-discovery #72533
+179
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Makes the
account_idsconfiguration field optional in the Facebook Marketing connector. When not provided, the connector automatically discovers all ad accounts accessible to the authenticated user via the Facebook Marketing API's/me/adaccountsendpoint.Requested by @alexanderankin
How
spec.py: Changed
account_idsfrom required to optional (Optional[Set[...]]withdefault=None, removedmin_items=1)api.py: Added
get_all_ad_accounts()method that usesUser(fbid="me").get_ad_accounts()to fetch all accessible accountssource.py: Added
_resolve_account_ids()helper that:Updated
check_connection()andstreams()to use the resolved account IDsReview guide
source_facebook_marketing/spec.py- Field definition changesource_facebook_marketing/api.py- New API method (lines 204-212)source_facebook_marketing/source.py- Core logic in_resolve_account_ids()(lines 93-109) and its usage incheck_connection()andstreams()unit_tests/test_source.pyandunit_tests/test_api.py- New test coverageItems to verify:
account_idsshould work unchangedconfig.account_idsincheck_connection()andstreams()- is this safe?User Impact
Users can now configure the Facebook Marketing connector without specifying account IDs. The connector will automatically sync data from all ad accounts accessible to their access token. Existing configurations with explicit account IDs continue to work unchanged.
Can this PR be safely reverted and rolled back?
Link to Devin run: https://app.devin.ai/sessions/d385487ef2be4882906890c5c5fbda93