-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎉 Source Facebook Marketing: Added support for multiple Facebook accounts #8237
🎉 Source Facebook Marketing: Added support for multiple Facebook accounts #8237
Conversation
Source Facebook Marketing: Support multiple Facebook accounts airbytehq#7740
@mlavoie-sm360 please run |
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py
Outdated
Show resolved
Hide resolved
except FacebookRequestError as exc: | ||
raise FacebookAPIException(f"Error: {exc.api_error_code()}, {exc.api_error_message()}") from exc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what will happen if we can't find some accounts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not finding some accounts raised an Exception. Now that we handle one or many accounts, I'm not sure what the behaviour should be. If I provide 5 accounts and I don't have access to one of them, do I want to raise an exception and break the flow, log a warning one of the accounts is missing or simply let the list have 4 accounts? I'm not sure what is the cleanest behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlavoie-sm360
I think the check should succeed only if all specified accounts are accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keu, thanks for your input. Is it all the same to you if that check is done in source.py
under def check_connection()
rather than here? At the moment, check_connection
fails if:
- strategy is
subset
and at least one account is missing from the list - strategy is
all
and no accounts are available - strategy selected is unsupported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlavoie-sm360 I agree with the above if the check is done in the source.py
, my only concern is that how the user will know that some accounts are not accessible anymore? How about we will have a warning for each missing account in _find_account
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keu, how about this?
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/spec.json
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/common.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py
Outdated
Show resolved
Hide resolved
…-multiple-account-support' into source-facebook-marketing-added-multiple-account-support # Conflicts: # airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py # airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams.py
@keu now it's possible to merge this? |
@marcosmarxm this PR will need to merge with the latest master (will do it myself), currently working on #6225. |
I'm closing this due inactivity. |
Update: First off, thank you for your contribution @mlavoie-sm360, we really appreciate it! We're going to hold off reviewing this as it looks like this would require a non-trivial migration of configuration. This is something we're scheduled to implement this coming quarter which you can follow along here https://github.com/airbytehq/airbyte-internal-issues/issues/206. Once complete, we'll come back and make sure we can get this merged. Thanks for your patience! |
Alright, thanks for the follow-up @misteryeo |
Hey, everyone! This would be a great improvement in the connection. |
Is it |
@jagannathsrs, if you are creating a new pipeline on this version, there are no issues. The configuration is straight forward, the major difference being that you are not restricted to a single Facebook account. |
…-multiple-account-support' into staging--source-facebook-marketing-added-multiple-account-support # Conflicts: # airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlavoie-sm360 could you fix the mentioned points? then your branch works for me in production and others might want to use your solution since FB just deprecated API v.12
|
||
import pendulum | ||
from cached_property import cached_property | ||
from facebook_business import FacebookAdsApi | ||
from facebook_business.adobjects import user as fb_user | ||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.exceptions import FacebookRequestError | ||
from source_facebook_marketing.common import FacebookAPIException | ||
from source_facebook_marketing.common import FacebookAPIException, SourceFacebookMarketingConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be ConnectorConfig
instead of SourceFacebookMarketingConfig
return account | ||
accounts_found = list(fb_user.User(fbid="me").get_ad_accounts()) | ||
if self.__config.account_selection_strategy_is_subset: | ||
account_ids = self.__config.account_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be self.__config.accounts.ids
raise FacebookAPIException("Couldn't find account with id {}".format(account_id)) | ||
def _accounts_missing_from_config(self, accounts:List[Type[AdAccount]]) -> Set[str]: | ||
"""Returns a list of account ids missing from config accounts""" | ||
config_account_ids = set(self.__config.account_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be self.__config.accounts.ids
Hello 👋, first thank you for this amazing contribution. We really appreciate the effort you've made to improve the project. If you have any questions feel free to send me a message in Slack! |
Hello 👋:skin-tone-2: and thank you for your contribution! Airbyte has instituted a code freeze between 19 and 30 December, to make sure there are no disruptions during the holidays. If you have any questions or need further clarification, please don't hesitate to ping via Slack. |
Closing for inactivity -- will reopen or reimplement once the blocking config migration issue airbytehq/airbyte-internal-issues#206 is resolved |
What
*Closes #7740
How
Recommended reading order
spec.json
common.py
api.py
source.py
streams.py
async_job.py
🚨 User Impact 🚨
Are there any breaking changes? If yes, please make sure to include it here and in any changelogs with the 🚨🚨 emoji
What is the end result perceived by the user?
Pre-merge Checklist
Updating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereThis change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)