-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Pinterest: Add report stream for CAMPAIGN
level
#28672
Conversation
Before Merging a Connector Pull RequestWow! 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:
If the checklist is complete, but the CI check is failing,
|
source-pinterest test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-pinterest/metadata.yaml | ✅ |
Connector version semver check | ✅ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-pinterest docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ❌ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-pinterest test
source-pinterest test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-pinterest/metadata.yaml | ✅ |
Connector version semver check | ✅ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-pinterest docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ❌ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-pinterest test
source-pinterest test report (commit
|
Step | Result |
---|---|
Validate airbyte-integrations/connectors/source-pinterest/metadata.yaml | ✅ |
Connector version semver check | ✅ |
QA checks | ✅ |
Code format checks | ✅ |
Connector package install | ✅ |
Build source-pinterest docker image for platform linux/x86_64 | ✅ |
Unit tests | ✅ |
Acceptance tests | ✅ |
Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command
airbyte-ci connectors --name=source-pinterest test
yield record | ||
|
||
def should_retry(self, response: requests.Response) -> bool: | ||
if isinstance(response.json(), dict): |
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 check has no sense, let's remove it
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 original code, just moved to stream file
- reponse.json() can return list object as well
airbyte-integrations/connectors/source-pinterest/source_pinterest/reports/reports.py
Show resolved
Hide resolved
report_info.report_status = report_status | ||
if report_status in {ReportStatus.DOES_NOT_EXIST, ReportStatus.EXPIRED, ReportStatus.FAILED, ReportStatus.CANCELLED}: | ||
message = "Report generation failed." | ||
raise ReportGenerationFailure(message) |
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 suggest we should make a queue of reports which should be appended with a failed report and retried when we finish iterating over the queue. This should be repeated for a couple of times if we keep on getting the same error for the report.
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 generate a queue with reports , it is necessary to override the logic at the read method level. The read_records level is only aware of one slice at a time. So, I think can leave this solution to fix oncall and after update with more complex logic as follow up
|
||
pending_report_status = [report_info for report_info in report_infos if report_info.report_status != ReportStatus.FINISHED] | ||
|
||
if len(pending_report_status) > 0: |
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 should be changed as well if we're going to implement a queue of reports
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.
raise ReportStatusError(error) | ||
return report_status.report_status, report_status.url | ||
|
||
def _fetch_report_data(self, url: str) -> dict: |
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.
perhaps we should wrap _fetch_report_data
and _verify_report_status
in streams to make it retriable and unify interfaces
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 understand that both _fetch_report_data
and _verify_report_status
may share some similarities in their nature, but it's important to acknowledge that they serve distinct purposes. Leaving them as they are would actually help maintain code clarity, as it allows each function to focus on its specific task without combining their functionalities.
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 didn't mean to wrap them in a single stream, rather two streams. But it's ok to leave it for later, when the oncall issue is resolved
Suspect IssuesThis pull request has been deployed and Sentry has observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
What
The change aims to overcome the 90-day data retrieval limitation for Pinterest analytics. Currently, the data pulled from the campaign_analytics stream is restricted to a maximum of 90 days back, causing us to miss out on important data that our Customers require for making informed decisions. By adopting a new approach using the endpoint POST - https://api.pinterest.com/v5/ad_accounts/{ad_account_id}/reports, we can now retrieve data beyond the 90-day mark, up to 914 days back, with a DAY granularity.
https://github.com/airbytehq/oncall/issues/2010
How
The solution involves the following steps:
🚨 User Impact 🚨
No
Pre-merge Actions
Updating a connector
Community member or Airbyter
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.