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 (no-singer) #1443
Source Facebook Marketing (no-singer) #1443
Conversation
...integrations/connectors/source-facebook-marketing/source_facebook_marketing/client/common.py
Outdated
Show resolved
Hide resolved
...integrations/connectors/source-facebook-marketing/source_facebook_marketing/client/common.py
Outdated
Show resolved
Hide resolved
|
||
@staticmethod | ||
def _find_account(account_id: str): | ||
accounts = fb_user.User(fbid='me').get_ad_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.
What do you think about next
to emulate find if?
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.
could you please give me some example?
I think the current version is not too difficult to read, but maybe I'm wrong...
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.
The current code is OK to read, agree. I was thinking about:
return next((x for x in accounts if x["account_id"] == account_id),)
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.
well, I like this magic, but not in the code :)
|
||
def read_stream(self, stream: AirbyteStream) -> Generator[AirbyteRecordMessage, None, None]: | ||
"""Yield records from stream""" | ||
method = self._stream_methods.get(stream.name) |
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.
I would consider moving this to the base class.
method = self.get_method(stream.name)
would be more concise and expressive.
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.
moved to base class, and fixed existing derived classes to accept kwargs
print(stream.json_schema) | ||
return [] | ||
|
||
def read_stream(self, stream: AirbyteStream) -> Generator[AirbyteRecordMessage, None, None]: |
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.
Why do you override base class method? Looks like the implementation is identical.
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.
to pass fields, please see my updates
...integrations/connectors/source-facebook-marketing/source_facebook_marketing/client/client.py
Outdated
Show resolved
Hide resolved
|
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.
This generally looks good. Just a few minor comments for now.
I'm going to run some tests on this later tonight or tomorrow morning.
airbyte-integrations/connectors/source-facebook-marketing/build.gradle
Outdated
Show resolved
Hide resolved
name: Facebook Marketing | ||
dockerRepository: airbyte/source-facebook-marketing | ||
dockerImageTag: 0.1.0 | ||
documentationUrl: https://hub.docker.com/r/airbyte/source-facebook-marketing | ||
- sourceDefinitionId: 74d47f79-8d01-44ac-9755-f5eb0d7caacb | ||
name: Facebook Marketing APIs |
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.
In a separate PR we should delete the Singer one.
@@ -0,0 +1,7 @@ | |||
* |
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.
Should this file be in this PR?
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.
deleted
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_client.py
Outdated
Show resolved
Hide resolved
|
||
fields = list(set(fields) - set(self.INVALID_INSIGHT_FIELDS)) | ||
|
||
# Some automatic fields (primary-keys) cannot be used as 'fields' query params. |
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.
This comment should be moved to where INVALID_INSIGHT_FIELDS
is defined.
…d.gradle Co-authored-by: Jared Rhizor <me@jaredrhizor.com>
Co-authored-by: Jared Rhizor <me@jaredrhizor.com>
…_tests/test_client.py Co-authored-by: Jared Rhizor <me@jaredrhizor.com>
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.
The integration tests are working and everything looks good, but there are errors when I run the unit tests with ./gradlew :airbyte-integrations:connectors:source-facebook-marketing:unitTest
from the airbyte root directory or .venv/bin/python -m pytest unit_tests
from the source's directory.
Messages must be strings for AirbyteLogMessage
.
This is the only issue blocking this PR.
@jrhizor thanks, I have fixed logger usage in the last commit |
You'll also have to run |
I'm running the build again from #1525 Please look into build failures if there are any. If it succeeds I'll merge this. Sorry for the delay. |
It looks like the changes here introduced a dependency issue as well. It's really slow for me to create a separate PR and wait for builds to iterate with feedback. Can you reopen this PR on an origin branch instead of a fork so the builds can run automatically? Then you can iterate until the build is passing without any involvement from me, and it will be obvious when this is ready to merge. Here's a failing build run: https://github.com/airbytehq/airbyte/runs/1651989807 Alternatively, you could ping me on this PR once |
closed in favor of #1552 |
Contributor Checklist
Thanks for contributing to Airbyte! Please complete the following items in order so we can review your PR.
./gradlew :airbyte-integrations:connectors:source-<your_source_name>:standardSourceTestPython
and pasted the summarized output as a comment in this PRReviewer Pre-merge Checklist
./tools/integrations/ci_credentials.sh
and.github/workflows/test-command.yml
*/test connector=<name>
*airbyte-config/init/src/main/resources/seed/source_definitions.yaml
to use the new source in Airbyte core./tools/integrations/manage.sh publish airbyte-integrations/connectors/source-<name>
Documentation
docs/integrations/sources/
folder in line with the documentation template found indocs/contributing-to-airbyte/templates/integration-documentation-template.md
.docs/SUMMARY.md
README.md